Available on crate feature
async only.Expand description
Tool-dispatch: the Tool trait, registry, typed inputs, and the agent
loop runner.
Three ergonomic shapes for registering tools:
Tooltrait – implement directly when each tool is its own type. Gives full control over the JSON Schema, the async handler, and errors.ToolRegistry::register– closure-based handler. The registry wraps closures in an internalFnTool<F>adapter. Convenient for one-off tools that don’t need a dedicated type.TypedTool+ToolRegistry::register_typed– typed-input handler driven byschemars. The input JSON is deserialized into a concreteArgstype before dispatch. Behind theschemars-toolsfeature (or use#[derive(Tool)]fromclaude-api-derivefor the most ergonomic form).
The agent loop lives in runner (feature conversation). It drives
repeated messages.create calls, dispatching tools in parallel via
Tool::invoke, optionally enforcing a cost budget and a mid-stream
approval gate.
Gated on the async feature.
Re-exports§
pub use registry::FnTool;pub use registry::ToolRegistry;pub use tool::ApprovalDecision;pub use tool::Tool;pub use tool::ToolApprover;pub use tool::ToolError;pub use tool::fn_approver;pub use runner::RunOptions;conversationpub use typed::TypedTool;schemars-tools