Skip to main content

Tool

Trait Tool 

Source
pub trait Tool: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn description(&self) -> &str;
    fn parameters_schema(&self) -> Value;
    fn execute<'life0, 'async_trait>(
        &'life0 self,
        args: Value,
    ) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn category(&self) -> ToolCategory { ... }
    fn origin(&self) -> ToolOrigin { ... }
    fn is_terminal(&self) -> bool { ... }
    fn spec(&self) -> ToolSpec { ... }
}
Expand description

Core tool trait for agent capabilities.

Required Methods§

Source

fn name(&self) -> &str

Tool name used in LLM function calling.

Source

fn description(&self) -> &str

Human-readable description shown to the LLM.

Source

fn parameters_schema(&self) -> Value

JSON Schema for the tool’s parameters.

Source

fn execute<'life0, 'async_trait>( &'life0 self, args: Value, ) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execute the tool with the given arguments.

Provided Methods§

Source

fn category(&self) -> ToolCategory

Tool category for profile-based filtering.

Source

fn origin(&self) -> ToolOrigin

Runtime ownership surface for this tool.

Source

fn is_terminal(&self) -> bool

Whether calling this tool should immediately end the turn loop.

Source

fn spec(&self) -> ToolSpec

Build the full spec for LLM registration.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§