Skip to main content

ToolHandler

Trait ToolHandler 

Source
pub trait ToolHandler: Send + Sync {
    // Required methods
    fn tool_type(&self) -> ToolType;
    fn validate(&self, param: &Value) -> Result<(), ToolError>;
    fn normalize(&self, param: &Value) -> Vec<FunctionTool>;
}
Expand description

Trait implemented by every tool type — client-owned and gateway-owned alike.

Covers validation and normalization: the steps that apply to all tools regardless of who executes them.

Implementations must be Send + Sync so they can be stored behind Arc<dyn ToolHandler> and used across async task boundaries.

Required Methods§

Source

fn tool_type(&self) -> ToolType

Source

fn validate(&self, param: &Value) -> Result<(), ToolError>

Validate the tool param JSON.

§Errors

Returns ToolError::Config for obviously invalid configurations.

Source

fn normalize(&self, param: &Value) -> Vec<FunctionTool>

Normalise this tool declaration into vLLM-compatible FunctionTool entries.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§