Expand description
Tool system.
Tools are the primary way the agent interacts with the environment.
Each tool implements the Tool trait and is registered in the
ToolRegistry for dispatch by name.
§Architecture
Tooltrait — defines the interface for all toolsToolRegistry— collects tools and dispatches by nameToolExecutor— manages concurrent/serial tool execution- Individual tool modules — concrete implementations
§Tool execution flow
- Input validation (schema check)
- Permission check (allow/ask/deny)
- Tool execution (
call) - Result mapping (to API format)
Modules§
- agent
- Agent tool: spawn subagents for parallel task execution.
- ask_
user - AskUserQuestion tool: interactive prompts during execution.
- bash
- Bash tool: execute shell commands.
- bash_
parse - Tree-sitter based bash command parser.
- executor
- Tool executor: manages concurrent and serial tool execution.
- file_
edit - FileEdit tool: targeted search-and-replace editing.
- file_
read - FileRead tool: read file contents with optional line ranges.
- file_
write - FileWrite tool: create or overwrite files.
- glob
- Glob tool: file pattern matching.
- grep
- Grep tool: regex-based content search.
- lsp_
tool - LSP tool: query language servers for diagnostics and symbols.
- mcp_
proxy - MCP proxy tool: bridges MCP server tools into the local tool system.
- mcp_
resources - MCP resource tools: list and read resources from MCP servers.
- multi_
edit - MultiEdit tool: batch search-and-replace across multiple locations in one file.
- notebook_
edit - NotebookEdit tool: edit Jupyter notebook cells.
- plan_
mode - Plan mode tools: switch between execution and planning modes.
- plugin_
exec - Plugin executable tool.
- powershell
- PowerShell tool for Windows environments.
- registry
- Tool registry: collects tools and dispatches by name.
- repl_
tool - REPL tool: execute code in a Python or Node.js REPL.
- send_
message - SendMessage tool: communicate between agents.
- skill_
tool - Skill tool: invoke skills dynamically from the agent.
- sleep_
tool - Sleep tool: pause execution for a specified duration.
- tasks
- Task management tools.
- todo_
write - TodoWrite tool: manage a structured todo list.
- tool_
search - ToolSearch tool: discover deferred tools by keyword.
- web_
fetch - WebFetch tool: fetch content from URLs.
- web_
search - WebSearch tool: search the web for information.
- worktree
- Worktree tools: manage isolated git worktrees for safe parallel work.
Structs§
- Auto
Allow Prompter - Default prompter that always allows (for non-interactive/testing).
- Tool
Context - Context passed to every tool during execution.
- Tool
Result - Result of a tool execution.
- Tool
Schema - Schema information for a tool, used when building API requests.
Enums§
- Permission
Response - Permission prompt response from the UI layer.
Traits§
- Permission
Prompter - Trait for prompting the user for permission decisions. Implemented by the CLI’s UI layer; the lib engine uses this abstraction.
- Tool
- The core trait that all tools must implement.