Tool registry — compiled tool table with dispatch.
Mirrors theRouter + Route pattern from chirp.routing:
ToolDef is the frozen definition (like Route), ToolRegistry
is the compiled lookup table (likeRouter).
Free-threading safety:
- ToolDef is a frozen dataclass (immutable)
- ToolRegistry._tools is a dict built at freeze time, never mutated
- ToolEventBus handles its own synchronization
tools.registry
| Name | Type | Default | Description |
|---|---|---|---|
type
|
|
— | |
qualified_name
|
|
— | |
element_type
|
|
— | |
description
|
|
— | |
source_file
|
|
— | |
line_number
|
|
— | |
is_autodoc
|
|
— | |
autodoc_element
|
|
— | |
_autodoc_template
|
|
— | |
_autodoc_url_path
|
|
— | |
_autodoc_page_type
|
|
— | |
title
|
|
— | |
doc_content_hash
|
|
— |
Symbols on this page
MCP tool list entry fortools/listresponse.
A frozen tool definition.
Created during app setup, compiled into the registry at freeze time.
Compiled tool table. Created at freeze time, immutable at runtime.
Provideslist_tools() for MCP tools/list and call_tool()
for MCPtools/calldispatch.
Compile pending tool registrations into a frozen ToolRegistry.
Called duringApp._freeze(). Each tuple is
(name, description, handler)or
(name, description, handler, approval_required).…
McpToolInfo
class
MCP tool list entry fortools/listresponse.
ToolDef
class
A frozen tool definition.
Created during app setup, compiled into the registry at freeze time.
ToolRegistry
class
Compiled tool table. Created at freeze time, immutable at runtime.
Provideslist_tools() for MCP tools/list and call_tool()
for MCPtools/calldispatch.
compile_tools
function
def compile_tools(pending: list[tuple[str, str, Callable[..., Any], bool] | tuple[str, str, Callable[..., Any]]], event_bus: ToolEventBus) -> ToolRegistry
Compile pending tool registrations into a frozen ToolRegistry.
Called duringApp._freeze(). Each tuple is
(name, description, handler)or
(name, description, handler, approval_required).
Schema generation happens here so errors surface at startup, not at runtime.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
pending
|
list[tuple[str, str, Callable[..., Any], bool] | tuple[str, str, Callable[..., Any]]]
|
— | |
event_bus
|
ToolEventBus
|
— |
View source · /home/runner/work/chirp/chirp/site/../src/chirp/tools/registry.py:1