Tool class
Represents an MCP Tool, serving as both an annotation and a data model.
Use this as an annotation on your functions:
@Tool(description: 'My awesome tool.')
String myTool() => 'Hello';
- Annotations
-
- @immutable
Constructors
Properties
- description → String?
-
A description of what the tool does.
If null, the generator will attempt to use the function's doc comment.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
inputSchema
→ Map<
String, dynamic> -
The JSON schema defining the tool's input arguments.
This is typically generated automatically from the function's parameters.
final
-
meta
→ Map<
String, dynamic> ? -
final
- name → String?
-
The official name of the tool for the MCP protocol.
If null when used as an annotation, the generator infers it from the function name.
final
- register → bool
-
Set to false to prevent the generator from registering this tool.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
securitySchemes
→ List<
Map< ?String, dynamic> > -
final
Methods
-
copyWith(
{String? name, String? description, Map< String, dynamic> ? inputSchema}) → Tool -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited