Expand description
Tool registry, definitions, execution, and path safety. Tool registry and execution engine.
Each tool is a function that takes JSON arguments and returns a string result. Path validation is enforced here to prevent directory traversal.
§Available tools
| Tool | Module | Effect | Description |
|---|---|---|---|
| Read | file_tools | ReadOnly | Read file contents with line numbers |
| Write | file_tools | LocalMutation | Create or overwrite a file |
| Edit | file_tools | LocalMutation | Find-and-replace in an existing file |
| Delete | file_tools | Destructive | Delete a file |
| List | file_tools | ReadOnly | List files and directories |
| Bash | shell | LocalMutation | Execute shell commands (with background mode) |
| Grep | grep | ReadOnly | Recursive text search (respects .gitignore) |
| Glob | glob_tool | ReadOnly | Find files by glob pattern |
| WebFetch | web_fetch | RemoteAction | Fetch URL content (HTML→text) |
| WebSearch | web_search | RemoteAction | Web search via DuckDuckGo |
| InvokeAgent | agent | LocalMutation | Delegate task to a sub-agent |
| ListAgents | agent | ReadOnly | List available sub-agents |
| MemoryRead | memory | ReadOnly | Read project/global memory |
| MemoryWrite | memory | LocalMutation | Save facts to memory |
| TodoWrite | todo | LocalMutation | Update task list |
| AskUser | ask_user | ReadOnly | Ask the user a question |
| ActivateSkill | skills | ReadOnly | Load a skill’s instructions |
| ListSkills | skills | ReadOnly | List available skills |
| ListBackgroundTasks | bg_task_tools | ReadOnly | Snapshot background tasks owned by the caller |
| CancelTask | bg_task_tools | ReadOnly | Cancel a background agent or process |
| WaitTask | bg_task_tools | ReadOnly | Block until a background task finishes (max 300 s) |
§Safety model
Every tool call is classified by ToolEffect and checked against the
current approval mode before execution. See
classify_tool for the effect of each tool.
Modules§
- agent
- Sub-agent invocation tool (
InvokeAgent,ListAgents). Sub-agent invocation and discovery tools. - ask_
user - AskUser tool — explicit clarification requests from the model.
- bg_
process - Background process registry.
- bg_
task_ tools - Background-task management tools —
ListBackgroundTasks,CancelTask,WaitTask(Layer 2 of #996). Background task management tools (Layer 2 of #996). - file_
tools - File CRUD tools (
Read,Write,Edit,Delete,List). File system tools: Read, Write, Edit, Delete, and List. - fuzzy
- Fuzzy (whitespace-normalized) text matching for the Edit tool.
- glob_
tool - Glob pattern search tool (
Glob). Glob tool — find files by pattern matching. - grep
- Recursive text search tool (
Grep). Grep tool — recursive text search across files. - memory
- Project memory read/write tools (
MemoryRead,MemoryWrite). Memory tools — read and write semantic memory. - recall
- On-demand conversation history retrieval (
RecallContext). RecallContext — on-demand conversation history retrieval. - shell
- Shell command execution tool (
Bash). Shell command execution tool (Bash). - skill_
tools - Skill discovery and activation tools (
ListSkills,ActivateSkill). Skill activation tools for the LLM. - todo
- Session-scoped task list tool (
TodoWrite). TodoWrite tool — session-scoped task list. - validate
- Pre-flight validation for tool calls (runs before approval). Pre-flight validation for tool calls.
- web_
fetch - HTTP fetch tool (
WebFetch). WebFetch tool — retrieve content from a URL. - web_
search - Web search tool (
WebSearch). WebSearch tool — query the web via DuckDuckGo.
Structs§
- Tool
Registry - The tool registry: maps tool names to their definitions and handlers.
- Tool
Result - Result of executing a tool.
Enums§
- Tool
Effect - Effect classification for tool calls.
Functions§
- classify_
tool - Classify a built-in tool by name.
- describe_
action - Generate a human-readable description of a tool action for approval prompts.
- is_
mutating_ tool - Returns true if the tool performs a mutating operation.
- resolve_
read_ path - Normalise a read-only path and enforce the fully-denied list.
- safe_
resolve_ path - Validate and resolve a path, preventing directory traversal.
Type Aliases§
- File
Read Cache - Shared file-read cache: tracks
(size, mtime, sha256_hex)per cache key. - Last
Bash Cache - Tracks the most recent successful Bash invocation.
- Last
Writer Cache - Tracks which tool last wrote each absolute file path.