Skip to main content

Tool

Trait Tool 

Source
pub trait Tool: Send + Sync {
    // Required methods
    fn definition(&self) -> ToolDefinition;
    fn execute<'life0, 'async_trait>(
        &'life0 self,
        params: Value,
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn risk_level(&self) -> RiskLevel { ... }
}

Required Methods§

Source

fn definition(&self) -> ToolDefinition

Source

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

Provided Methods§

Source

fn risk_level(&self) -> RiskLevel

Risk level of this tool. Defaults to Safe (read-only). Override in tools that modify state.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§