Skip to main content

Module tool

Module tool 

Source
Available on crate feature async only.
Expand description

The Tool async trait and its companion ToolError.

Tool is the foundation for every tool-dispatch shape: direct trait implementations, closure adapters via FnTool, and schemars-driven typed handlers (crate::tool_dispatch::TypedTool) all reduce to a dyn Tool stored in the registry.

ToolApprover is the mid-stream approval gate: each pending tool call is passed to an approver before it executes; return ApprovalDecision::Deny to short-circuit the tool and inject an error result instead.

Enums§

ApprovalDecision
Verdict from a ToolApprover for a single tool_use invocation.
ToolError
Errors a Tool implementation can return.

Traits§

Tool
A tool the model can invoke during generation.
ToolApprover
Async-callable predicate consulted before each tool dispatch.

Functions§

fn_approver
Wrap an async closure into a ToolApprover.