Tool class abstract
Abstract base for all tools. Enhanced port of neomage/src/Tool.ts with permissions, safety flags, and execution context.
- Implementers
- AgentTool
- BashTool
- ComputerUseTool
- ConfigTool
- ConfigTool
- DiffApplyTool
- EnterPlanModeTool
- ExitPlanModeTool
- ExitPlanModeTool
- FileEditTool
- FileReadTool
- FileWriteTool
- FileWriteToolMixin
- GlobTool
- GrepTool
- JsSandboxTool
- LspTool
- LspTool
- MCPTool
- McpTool
- MemoryTool
- MultiEditTool
- NotebookEditTool
- NotebookEditTool
- PowerShellTool
- PowerShellTool
- ReadOnlyToolMixin
- ScreenshotTool
- SendMessageTool
- ShellToolMixin
- SkillTool
- SkillTool
- SubagentTool
- TaskOutputTool
- TaskUpdateTool
- TodoWriteTool
- ToolSearchTool
- ValidateTool
Constructors
- Tool()
Properties
- alwaysLoad → bool
-
Whether this tool should always be loaded (never deferred).
no setter
- definition → ToolDefinition
-
Convert to API tool definition.
no setter
- description → String
-
Human-readable description.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
inputSchema
→ Map<
String, dynamic> -
JSON Schema for the tool's input parameters.
no setter
- interruptBehavior → InterruptBehavior
-
How this tool behaves when interrupted by user input.
no setter
- isAvailable → bool
-
Whether this tool is available on the current platform.
no setter
- isConcurrencySafe → bool
-
Whether this tool is safe to run concurrently with other tools.
no setter
- isDestructive → bool
-
Whether this tool can cause destructive changes.
no setter
- isEnabled → bool
-
Whether this tool is enabled (can be toggled by config).
no setter
- isMcp → bool
-
Whether this tool comes from an MCP server.
no setter
- isReadOnly → bool
-
Whether this tool only reads data (no side effects).
no setter
- maxResultSizeChars → int?
-
Maximum size in characters for tool results before disk persistence.
no setter
-
mcpInfo
→ Map<
String, dynamic> ? -
MCP server info if this is an MCP tool.
no setter
- name → String
-
Tool name as registered with the API.
no setter
- prompt → String
-
Detailed prompt text sent in the system prompt for this tool.
no setter
- requiresUserInteraction → bool
-
Whether this tool requires user interaction (prompts, confirmations).
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shouldDefer → bool
-
Whether this tool should be deferred (loaded on demand via ToolSearch).
no setter
- strict → bool
-
Whether this tool enforces strict JSON output.
no setter
- userFacingName → String
-
Human-facing name for display in permission prompts.
no setter
Methods
-
call(
Map< String, dynamic> input, ToolUseContext context) → Future<ToolResult> - Execute with full context (default delegates to simple execute).
-
checkPermissions(
Map< String, dynamic> input, ToolPermissionContext permContext) → Future<PermissionDecision> - Check if this tool use is permitted. Returns a PermissionDecision. Override in subclasses for tool-specific permission logic.
-
execute(
Map< String, dynamic> input) → Future<ToolResult> - Execute the tool with the given input.
-
getActivityDescription(
Map< String, dynamic> input) → String - Activity description for status display.
-
getPermissionExplanation(
Map< String, dynamic> input) → PermissionExplanation? - Permission explanation for this tool.
-
getToolUseSummary(
Map< String, dynamic> input) → String - Short summary of tool use for compact/grouped display.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toAutoClassifierInput(
Map< String, dynamic> input) → String - Generate classifier input for auto-permission decisions. Returns empty string to skip classification.
-
toString(
) → String -
A string representation of this object.
inherited
-
validateInput(
Map< String, dynamic> input) → ValidationResult - Validate input before execution and permission checks.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited