Tool Registry
The tool registry manages all tools available to the agent during a conversation. It tracks where each tool comes from and supports filtering by source.
Tool Sources
Every registered tool has a ToolSource that identifies its origin:
Builtin— tools shipped with the binary (exec, web_fetch, etc.)Mcp { server }— tools provided by an MCP server, tagged with the server name
This replaces the previous convention of identifying MCP tools by their
mcp__ name prefix, providing type-safe filtering instead of string matching.
Registration
#![allow(unused)] fn main() { // Built-in tool registry.register(Box::new(MyTool::new())); // MCP tool — tagged with server name registry.register_mcp(Box::new(adapter), "github".to_string()); }
Filtering
When MCP tools are disabled for a session, the registry can produce a filtered copy:
#![allow(unused)] fn main() { // Type-safe: filters by ToolSource::Mcp variant let no_mcp = registry.clone_without_mcp(); // Remove all MCP tools in-place (used during sync) let removed_count = registry.unregister_mcp(); }
Schema Output
list_schemas() includes source metadata in every tool schema:
{
"name": "exec",
"description": "Execute a command",
"parameters": { ... },
"source": "builtin"
}
{
"name": "mcp__github__search",
"description": "Search GitHub",
"parameters": { ... },
"source": "mcp",
"mcpServer": "github"
}
The source and mcpServer fields are available to the UI for rendering
tools grouped by origin.