pub trait ToolExecutor: Send + Sync {
// Required method
fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tool: &'life1 str,
params: &'life2 Value,
) -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
// Provided method
fn execute_with_action<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tool: &'life1 str,
params: &'life2 Value,
_action_id: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
}Expand description
Trait for tool execution. Implement this to provide tools to the runtime.
In-process: implement directly with function calls. Daemon mode: implement by sending JSON-RPC to the client.
Required Methods§
fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tool: &'life1 str,
params: &'life2 Value,
) -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Provided Methods§
Sourcefn execute_with_action<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tool: &'life1 str,
params: &'life2 Value,
_action_id: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn execute_with_action<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tool: &'life1 str,
params: &'life2 Value,
_action_id: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Variant that also carries the originating proposal Action.id.
WS-based executors (car-server-core::WsToolExecutor) use it so
the daemon-initiated tools.execute request to the client
carries the same id the host’s process-wide handler is keyed on
— without this round-trip the host can’t disambiguate concurrent
callbacks for the same tool (Parslee-ai/car-releases#43
follow-up). In-process executors that don’t need it can keep the
default forward to [execute].