Skip to main content

ErasedTool

Trait ErasedTool 

Source
pub trait ErasedTool:
    Send
    + Sync
    + 'static {
    // Required methods
    fn name(&self) -> &'static str;
    fn description(&self) -> &'static str;
    fn schema(&self) -> Schema;
    fn erased_execute<'life0, 'life1, 'async_trait>(
        &'life0 self,
        ctx_request: &'life1 ContextRequest,
        args: Value,
    ) -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn erased_is_available<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _ctx_request: &'life1 ContextRequest,
        _compiled_context: &'life2 Value,
    ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}
Expand description

Type-erased trait for tools registered dynamically at runtime.

Required Methods§

Source

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

Unique identifier name of the tool.

Source

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

Human/LLM-readable description explaining the tool’s capability.

Source

fn schema(&self) -> Schema

JSON Schema describing expected tool call arguments.

Source

fn erased_execute<'life0, 'life1, 'async_trait>( &'life0 self, ctx_request: &'life1 ContextRequest, args: Value, ) -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Executes the tool with untyped JSON arguments and returns structured JSON output.

Provided Methods§

Source

fn erased_is_available<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _ctx_request: &'life1 ContextRequest, _compiled_context: &'life2 Value, ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Evaluated per turn to determine if tool is currently active/available.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl ErasedTool for ToolHandle

Source§

impl<T> ErasedTool for T
where T: Tool,