Skip to main content

TypedTool

Trait TypedTool 

Source
pub trait TypedTool: Send + Sync {
    type Args: DeserializeOwned + JsonSchema;
    type Output: Serialize;

    // Required methods
    fn name(&self) -> &'static str;
    fn description(&self) -> &'static str;
    fn call_typed<'life0, 'life1, 'async_trait>(
        &'life0 self,
        args: Self::Args,
        ctx: &'life1 ToolContext,
    ) -> Pin<Box<dyn Future<Output = AgentResult<Self::Output>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn format_output(&self, output: Self::Output) -> Content { ... }
    fn origin(&self) -> &'static str { ... }
    fn version(&self) -> &'static str { ... }
}

Required Associated Types§

Required Methods§

Source

fn name(&self) -> &'static str

Source

fn description(&self) -> &'static str

Source

fn call_typed<'life0, 'life1, 'async_trait>( &'life0 self, args: Self::Args, ctx: &'life1 ToolContext, ) -> Pin<Box<dyn Future<Output = AgentResult<Self::Output>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Provided Methods§

Source

fn format_output(&self, output: Self::Output) -> Content

Source

fn origin(&self) -> &'static str

Machine-readable origin of this tool (crate name, "agent-base", or "custom").

Source

fn version(&self) -> &'static str

Crate/package version, or "unknown" when built outside a crate.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§