Skip to main content

ErasedAsyncTool

Trait ErasedAsyncTool 

Source
pub trait ErasedAsyncTool<Ctx>: Send + Sync {
    // Required methods
    fn name_str(&self) -> &str;
    fn display_name(&self) -> &'static str;
    fn description(&self) -> &'static str;
    fn input_schema(&self) -> Value;
    fn tier(&self) -> ToolTier;
    fn execute<'life0, 'life1, 'async_trait>(
        &'life0 self,
        ctx: &'life1 ToolContext<Ctx>,
        input: Value,
    ) -> Pin<Box<dyn Future<Output = Result<ToolOutcome>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn check_status_stream<'a>(
        &'a self,
        ctx: &'a ToolContext<Ctx>,
        operation_id: &'a str,
    ) -> Pin<Box<dyn Stream<Item = ErasedToolStatus> + Send + 'a>>;
}
Expand description

Type-erased async tool trait for registry storage.

This allows async tools with different Name and Stage associated types to be stored in the same registry by erasing the type information.

Required Methods§

Source

fn name_str(&self) -> &str

Get the tool name as a string.

Source

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

Get a human-friendly display name for the tool.

Source

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

Get the tool description.

Source

fn input_schema(&self) -> Value

Get the JSON schema for tool inputs.

Source

fn tier(&self) -> ToolTier

Get the tool’s permission tier.

Source

fn execute<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 ToolContext<Ctx>, input: Value, ) -> Pin<Box<dyn Future<Output = Result<ToolOutcome>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute the tool with the given input.

Source

fn check_status_stream<'a>( &'a self, ctx: &'a ToolContext<Ctx>, operation_id: &'a str, ) -> Pin<Box<dyn Stream<Item = ErasedToolStatus> + Send + 'a>>

Stream status updates for an in-progress operation (type-erased).

Implementors§