Skip to main content

Tool

Trait Tool 

Source
pub trait Tool:
    Debug
    + WasmCompatSend
    + WasmCompatSync {
    // Required methods
    fn name(&self) -> &ToolName;
    fn description(&self) -> &ToolDescription;
    fn parameters(&self) -> &GenerationSchema;
    fn call(&self, args: Value) -> ToolResult;
}
Expand description

Trait boundary implemented by callable Rust tools.

Required Methods§

Source

fn name(&self) -> &ToolName

Returns the tool name visible to the model.

Source

fn description(&self) -> &ToolDescription

Returns the human-readable tool description visible to the model.

Source

fn parameters(&self) -> &GenerationSchema

Returns the JSON argument schema visible to the model.

Source

fn call(&self, args: Value) -> ToolResult

Executes the tool with model-supplied arguments.

§Errors

Returns ToolCallError when the handler cannot satisfy the model’s request. The error text is forwarded back through the bridge as the tool result error.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§