Expand description
Tool subsystem: trait definition, registry, and built-in tool implementations.
Every capability the agent can invoke (file I/O, git, shell, browser, etc.) is
a struct that implements the Tool trait. Tools are collected into a
ToolRegistry at agent startup — ToolRegistry::new() pre-registers all
built-in tools, and additional tools (MCP server tools, FIM edit) can be added
via ToolRegistry::register.
§Tool execution lifecycle
- The LLM emits a tool call with a name and JSON arguments.
- The agent resolves the name against
ToolRegistry::get. - Arguments are validated against the tool’s
Tool::schemaviavalidate_tool_arguments_schema(required-field and type checks). - The safety checker gates execution (confirmation prompts, deny-lists).
Tool::executeruns asynchronously and returns a JSON result.- The result is fed back into the conversation for the next LLM turn.
Modules§
- analyzer
- browser
- Browser Automation Tools
- cargo
- clarify
ask_usertool: lets the agent ask the human a single clarifying question when the task direction is genuinely ambiguous.- code_
metrics - Code metrics analysis tool.
- codemap
- Code map tools for context-aware action planning.
- computer
- Computer control tools: mouse, keyboard, screen capture, window management.
- container
- Container Tools (Docker & Podman)
- context
- Context management tools — allow the model to inspect and optimize its context window.
- file
- fim
- git
- git_
worktree - Git Worktree Isolation Tools
- grep_
search - Grep search tool - searches file contents using regex patterns.
- http
- HTTP request tool for web/API interactions
- introspect
- Code Introspection Tools for Selfware Evolution
- knowledge
- Knowledge Graph Tools
- localize_
issue - Localize issue tool — ranks candidate files/functions/tests for a given issue description using BM25-style keyword scoring, test-file proximity, and recent git change history.
- lsp_
tools - LSP tool wrappers for the agent’s tool registry.
- net_
policy - Shared network-policy helpers for URL / IP validation.
- package
- Package Manager Tools
- page_
controller - Page Controller — full Playwright-based browser automation tool.
- patch_
apply - process
- Process Management Tools
- prompt
- Tool prompt trait for rich LLM-facing descriptions.
- pty_
shell - PTY-based interactive shell sessions.
- screen_
capture - Screen capture tool for general-purpose screenshot functionality.
- search
- shell_
exec - Shell execution tool - runs shell commands with timeout and safety checks.
- task_
focus - Task-focused tool prioritization.
- tool_
search - Tool Search - Allows LLM to discover deferred tools on demand.
- vision
- Vision tools for analyzing and comparing images via vision-capable LLMs.
Structs§
- Pagination
Info - Pagination metadata for truncated tool output.
- Tool
Info - Metadata about a registered tool for search and categorization.
- Tool
Registry - Name-keyed registry of available tools with support for deferred loading.
Constants§
- CRITICAL_
TOOLS - List of critical tools that are always available. These are the minimal tools needed for basic operations.
Traits§
- Tool
- A capability the agent can invoke during task execution.
Functions§
- truncate_
with_ pagination - Truncate
outputat character boundaries, returning the page and pagination metadata. - validate_
tool_ arguments_ schema - Validate tool arguments against the top-level JSON schema contract exposed to the model.