pub trait ToolDyn: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn description(&self) -> &str;
fn input_schema(&self) -> Value;
fn call(
&self,
input: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, ToolError>> + Send + '_>>;
// Provided methods
fn maybe_streaming(&self) -> Option<&dyn ToolDynStreaming> { ... }
fn concurrency_hint(&self) -> ToolConcurrencyHint { ... }
}Expand description
Object-safe trait for tool implementations.
Any tool source (local function, MCP server, HTTP endpoint) implements
this trait. Tools are stored as Arc<dyn ToolDyn> in ToolRegistry.
Required Methods§
Sourcefn description(&self) -> &str
fn description(&self) -> &str
Human-readable description of what the tool does.
Sourcefn input_schema(&self) -> Value
fn input_schema(&self) -> Value
JSON Schema for the tool’s input parameters.
Provided Methods§
Sourcefn maybe_streaming(&self) -> Option<&dyn ToolDynStreaming>
fn maybe_streaming(&self) -> Option<&dyn ToolDynStreaming>
If this tool also supports streaming, return a reference to its streaming interface. Default is None; streaming is opt-in and non-disruptive.
Sourcefn concurrency_hint(&self) -> ToolConcurrencyHint
fn concurrency_hint(&self) -> ToolConcurrencyHint
Optional concurrency hint used by planners/deciders.
Default is Exclusive to preserve backward-compatible behavior.