Skip to main content

Module tools

Module tools 

Source
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

  • Tool trait — defines the interface for all tools
  • ToolRegistry — collects tools and dispatches by name
  • ToolExecutor — manages concurrent/serial tool execution
  • Individual tool modules — concrete implementations

§Tool execution flow

  1. Input validation (schema check)
  2. Permission check (allow/ask/deny)
  3. Tool execution (call)
  4. 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§

AutoAllowPrompter
Default prompter that always allows (for non-interactive/testing).
ToolContext
Context passed to every tool during execution.
ToolResult
Result of a tool execution.
ToolSchema
Schema information for a tool, used when building API requests.

Enums§

PermissionResponse
Permission prompt response from the UI layer.

Traits§

PermissionPrompter
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.