Executable

Trait Executable 

Source
pub trait Executable: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn description(&self) -> &str;
    fn input_schema(&self) -> &str;
    fn tool_type(&self) -> ToolType;
    fn execute(
        &self,
        context: ToolContext,
        input: HashMap<String, Value>,
    ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send>>;

    // Provided methods
    fn to_definition(&self) -> ToolDefinition { ... }
    fn to_llm_tool(&self) -> LLMTool { ... }
    fn display_config(&self) -> DisplayConfig { ... }
    fn compact_summary(
        &self,
        _input: &HashMap<String, Value>,
        _result: &str,
    ) -> String { ... }
}
Expand description

Trait for executable tools.

Required Methods§

Source

fn name(&self) -> &str

Get the tool name.

Source

fn description(&self) -> &str

Get the tool description.

Source

fn input_schema(&self) -> &str

Get the input schema as JSON string.

Source

fn tool_type(&self) -> ToolType

Get the tool type.

Source

fn execute( &self, context: ToolContext, input: HashMap<String, Value>, ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send>>

Execute the tool with given input.

Provided Methods§

Source

fn to_definition(&self) -> ToolDefinition

Convert to LLM tool definition.

Source

fn to_llm_tool(&self) -> LLMTool

Convert to LLMTool for provider APIs.

Source

fn display_config(&self) -> DisplayConfig

Get display configuration for UI rendering.

Source

fn compact_summary( &self, _input: &HashMap<String, Value>, _result: &str, ) -> String

Generate compact summary for context compaction.

Implementors§