Skip to main content

Tool

Trait Tool 

Source
pub trait Tool: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn description(&self) -> &str;
    fn schema(&self) -> Value;
    fn capabilities_required(&self) -> Vec<SkillCapability>;
    fn execute<'life0, 'life1, 'async_trait>(
        &'life0 self,
        input: Value,
        ctx: &'life1 ToolContext,
    ) -> Pin<Box<dyn Future<Output = Result<ToolOutput>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Trait for executable tools that the agent can invoke.

Tools are registered in a ToolRegistry and matched to LLM tool calls. Each tool declares its capabilities so the security layer can enforce permission boundaries.

Required Methods§

Source

fn name(&self) -> &str

Unique tool name (e.g. “memory_search”, “file_read”).

Source

fn description(&self) -> &str

Human-readable description for the LLM.

Source

fn schema(&self) -> Value

JSON Schema for the tool’s input parameters.

Source

fn capabilities_required(&self) -> Vec<SkillCapability>

Capabilities this tool requires (used for WASM sandbox enforcement).

Source

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

Execute the tool with the given input and context.

Implementors§