Skip to main content

Module registry

Module registry 

Source
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:

Both reduce to the same Arc<dyn Tool>. ToolRegistry::to_messages_tools converts the registered schemas into the Tool slice needed by CreateMessageRequest::tools.

For typed inputs derived from a Rust struct see crate::tool_dispatch::TypedTool and the schemars-tools feature.

Structsยง

FnTool
Internal adapter: wraps a closure and exposes it through the Tool trait. Created by ToolRegistry::register and ToolRegistry::register_described.
ToolRegistry
In-memory registry of tools keyed by name.