Skip to main content

Callable

Trait Callable 

Source
pub trait Callable: Send + Sync {
    // Required methods
    fn definition(&self) -> &Definition;
    fn validate(&self, input: &ToolInput) -> ValidationResult;
    fn call<'life0, 'life1, 'async_trait>(
        &'life0 self,
        ctx: &'life1 Context,
        input: ToolInput,
    ) -> Pin<Box<dyn Future<Output = AppResult<ToolResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Type-erased tool interface for heterogeneous registries.

Required Methods§

Source

fn definition(&self) -> &Definition

Return the tool’s metadata.

Source

fn validate(&self, input: &ToolInput) -> ValidationResult

Validate input against the tool’s input schema.

Source

fn call<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 Context, input: ToolInput, ) -> Pin<Box<dyn Future<Output = AppResult<ToolResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute the tool with a context and JSON input.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§