Skip to main content

StaticToolExecute

Trait StaticToolExecute 

Source
pub trait StaticToolExecute:
    Send
    + Sync
    + 'static {
    // Required method
    fn execute<'life0, 'life1, 'async_trait>(
        &'life0 self,
        call: ToolCall<'life1>,
    ) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn prepare_tool_call<'life0, 'life1, 'async_trait>(
        &'life0 self,
        pending: PendingToolCall,
        _context: &'life1 ToolPrepareContext,
    ) -> Pin<Box<dyn Future<Output = Result<PreparedToolCall, ToolResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Per-call execution behavior for a StaticToolProvider.

Implement this on the struct that owns the tool’s runtime state (HTTP clients, shared mutable state, configuration flags, …). The provider’s manifests and contracts come from the ToolDefinitions passed to StaticToolProvider::new; this trait supplies only the dynamic behavior.

Required Methods§

Source

fn execute<'life0, 'life1, 'async_trait>( &'life0 self, call: ToolCall<'life1>, ) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute a resolved tool call. Dispatch on call.name when serving more than one tool.

Provided Methods§

Source

fn prepare_tool_call<'life0, 'life1, 'async_trait>( &'life0 self, pending: PendingToolCall, _context: &'life1 ToolPrepareContext, ) -> Pin<Box<dyn Future<Output = Result<PreparedToolCall, ToolResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Optional argument-preparation hook, mirroring ToolProvider::prepare_tool_call. Defaults to the identity transform.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§