Skip to main content

ToolDefinitionLike

Trait ToolDefinitionLike 

Source
pub trait ToolDefinitionLike: Send + Sync {
    // Required methods
    fn tool_name(&self) -> &str;
    fn tool_label(&self) -> &str;
    fn tool_description(&self) -> &str;
    fn tool_parameters(&self) -> Value;
    fn tool_execute(
        &self,
        tool_call_id: &str,
        params: Value,
        signal: Option<Receiver<()>>,
    ) -> Pin<Box<dyn Future<Output = Result<AgentToolResult, ToolError>> + Send>>;
}
Expand description

Trait for tool definitions that can be wrapped into AgentTool.

Required Methods§

Source

fn tool_name(&self) -> &str

Returns the tool name used in LLM function-calling.

Source

fn tool_label(&self) -> &str

Returns a human-readable label for UI display.

Source

fn tool_description(&self) -> &str

Returns the tool description sent to the LLM.

Source

fn tool_parameters(&self) -> Value

Returns the JSON schema for the tool’s parameters.

Source

fn tool_execute( &self, tool_call_id: &str, params: Value, signal: Option<Receiver<()>>, ) -> Pin<Box<dyn Future<Output = Result<AgentToolResult, ToolError>> + Send>>

Executes the tool with the given call ID, parameters, and optional cancellation signal.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§