Available on crate feature
async only.Expand description
ToolRegistry and the FnTool closure adapter.
The registry holds heterogeneous Tool implementations behind
Arc<dyn Tool> and supports two registration shapes:
ToolRegistry::register_tooltakes anything that implementsTooldirectly.ToolRegistry::registertakes a closure plus name/schema; the closure is wrapped in an internalFnToolthat implementsTool.
Both reduce to the same Arc<dyn Tool>, so the agent loop runner
(#20) and the model’s tool list (ToolRegistry::to_messages_tools)
treat them identically.
Structs§
- FnTool
- Internal adapter: wraps a closure and exposes it through the
Tooltrait. Created byToolRegistry::registerandToolRegistry::register_described. - Tool
Registry - In-memory registry of tools keyed by name.