Skip to main content

ToolProvider

Trait ToolProvider 

Source
pub trait ToolProvider: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn version(&self) -> &str;
    fn schema(&self) -> &ToolSchema;
    fn call(&self, input: Value) -> Result<Value, ToolError>;

    // Provided methods
    fn call_async<'a>(&'a self, input: Value) -> ToolFuture<'a, Value> { ... }
    fn effects(&self) -> Vec<String> { ... }
    fn capabilities(&self) -> Vec<Capability> { ... }
}
Expand description

A pluggable tool provider. Implementations live in separate crates (e.g. an HTTP provider, an MCP provider, a mock provider).

Required Methods§

Source

fn name(&self) -> &str

Human-readable provider name (e.g. "openai", "anthropic").

Source

fn version(&self) -> &str

Semver version of the provider implementation.

Source

fn schema(&self) -> &ToolSchema

Schema describing the tool this provider exposes.

Source

fn call(&self, input: Value) -> Result<Value, ToolError>

Execute the tool with the given JSON input, returning JSON output.

Provided Methods§

Source

fn call_async<'a>(&'a self, input: Value) -> ToolFuture<'a, Value>

Async execution hook.

Default implementation preserves backwards compatibility by delegating to sync call.

Source

fn effects(&self) -> Vec<String>

Declared effect kinds this provider may trigger.

Source

fn capabilities(&self) -> Vec<Capability>

Capabilities supported by this provider (default: empty).

Implementors§