pub trait ToolExecutor: Send + Sync {
// Required method
fn execute(
&self,
response: &str,
) -> impl Future<Output = Result<Option<ToolOutput>, ToolError>> + Send;
// Provided methods
fn execute_confirmed(
&self,
response: &str,
) -> impl Future<Output = Result<Option<ToolOutput>, ToolError>> + Send { ... }
fn tool_definitions(&self) -> Vec<ToolDef> { ... }
fn execute_tool_call(
&self,
_call: &ToolCall,
) -> impl Future<Output = Result<Option<ToolOutput>, ToolError>> + Send { ... }
fn set_skill_env(&self, _env: Option<HashMap<String, String>>) { ... }
}Expand description
Async trait for tool execution backends (shell, future MCP, A2A).
Accepts the full LLM response and returns an optional output.
Returns None when no tool invocation is detected in the response.
Required Methods§
fn execute( &self, response: &str, ) -> impl Future<Output = Result<Option<ToolOutput>, ToolError>> + Send
Provided Methods§
Sourcefn execute_confirmed(
&self,
response: &str,
) -> impl Future<Output = Result<Option<ToolOutput>, ToolError>> + Send
fn execute_confirmed( &self, response: &str, ) -> impl Future<Output = Result<Option<ToolOutput>, ToolError>> + Send
Execute bypassing confirmation checks (called after user approves).
Default: delegates to execute.
Sourcefn tool_definitions(&self) -> Vec<ToolDef>
fn tool_definitions(&self) -> Vec<ToolDef>
Return tool definitions this executor can handle.
Sourcefn execute_tool_call(
&self,
_call: &ToolCall,
) -> impl Future<Output = Result<Option<ToolOutput>, ToolError>> + Send
fn execute_tool_call( &self, _call: &ToolCall, ) -> impl Future<Output = Result<Option<ToolOutput>, ToolError>> + Send
Execute a structured tool call. Returns None if tool_id is not handled.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.