pub trait GatewayExecutor: ToolHandler + 'static {
// Required method
fn execute(
&self,
call_id: &str,
tool_name: &str,
arguments: &str,
config: &Value,
) -> Pin<Box<dyn Future<Output = Result<ToolOutput, ToolError>> + Send + '_>>;
}Expand description
Extension of ToolHandler for tool types that are executed by the gateway.
Only gateway-owned tools (Mcp, WebSearch, FileSearch, CodeInterpreter)
implement this trait. Client-owned tools (Function) do not — the type system
makes it impossible to call execute() on them.
§Note on async fn in traits
Native async fn in traits (Rust 1.75+) is not yet dyn-compatible. Since
PR B will store handlers as Arc<dyn GatewayExecutor>, we use explicit
Pin<Box<dyn Future>> return types.
Required Methods§
Sourcefn execute(
&self,
call_id: &str,
tool_name: &str,
arguments: &str,
config: &Value,
) -> Pin<Box<dyn Future<Output = Result<ToolOutput, ToolError>> + Send + '_>>
fn execute( &self, call_id: &str, tool_name: &str, arguments: &str, config: &Value, ) -> Pin<Box<dyn Future<Output = Result<ToolOutput, ToolError>> + Send + '_>>
Execute a tool call and return the result.
§config parameter
config is the serialised server-level tool param (i.e. the *ToolParam
struct stored in super::registry::ToolEntry::config). It is not the
per-tool parameter schema.
§Errors
Returns ToolError::Execution if the tool call fails.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".