Skip to main content

Module tools

Module tools 

Source
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

ToolModuleEffectDescription
Readfile_toolsReadOnlyRead file contents with line numbers
Writefile_toolsLocalMutationCreate or overwrite a file
Editfile_toolsLocalMutationFind-and-replace in an existing file
Deletefile_toolsDestructiveDelete a file
Listfile_toolsReadOnlyList files and directories
BashshellLocalMutationExecute shell commands (with background mode)
GrepgrepReadOnlyRecursive text search (respects .gitignore)
Globglob_toolReadOnlyFind files by glob pattern
WebFetchweb_fetchRemoteActionFetch URL content (HTML→text)
WebSearchweb_searchRemoteActionWeb search via DuckDuckGo
InvokeAgentagentLocalMutationDelegate task to a sub-agent
ListAgentsagentReadOnlyList available sub-agents
MemoryReadmemoryReadOnlyRead project/global memory
MemoryWritememoryLocalMutationSave facts to memory
TodoWritetodoLocalMutationUpdate task list
AskUserask_userReadOnlyAsk the user a question
ActivateSkillskillsReadOnlyLoad a skill’s instructions
ListSkillsskillsReadOnlyList available skills
ListBackgroundTasksbg_task_toolsReadOnlySnapshot background tasks owned by the caller
CancelTaskbg_task_toolsReadOnlyCancel a background agent or process
WaitTaskbg_task_toolsReadOnlyBlock 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§

ToolRegistry
The tool registry: maps tool names to their definitions and handlers.
ToolResult
Result of executing a tool.

Enums§

ToolEffect
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§

FileReadCache
Shared file-read cache: tracks (size, mtime, sha256_hex) per cache key.
LastBashCache
Tracks the most recent successful Bash invocation.
LastWriterCache
Tracks which tool last wrote each absolute file path.