Skip to main content

Tool

Trait Tool 

Source
pub trait Tool:
    Send
    + Sync
    + 'static {
    // Required methods
    fn name(&self) -> &str;
    fn description(&self) -> &str;
    fn schema(&self) -> Value;
    fn call<'life0, 'async_trait>(
        &'life0 self,
        input: Value,
    ) -> Pin<Box<dyn Future<Output = Result<ToolOutput>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Unified contract for agent tools.

Required Methods§

Source

fn name(&self) -> &str

Returns the public tool name.

Source

fn description(&self) -> &str

Returns a short tool description.

Source

fn schema(&self) -> Value

Returns a JSON schema describing the tool input.

Source

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

Executes the tool.

Implementors§