macro_rules! tool_executor_forward {
($inner:ident) => { ... };
}Expand description
Forwards the four mechanical capability methods of
ToolExecutor — the checkpoint trio and is_tool_speculatable
— to self.$inner.
Use inside impl ToolExecutor for YourWrapper where $inner is the field name
(an identifier, not an expression — macro hygiene forbids capturing self at item
position) of a field whose type implements ToolExecutor.
The two policy methods, requires_confirmation and execute_tool_call_confirmed, are
intentionally not emitted by this macro — wrappers that gate on confirmation or
checkpoint policy must implement those two explicitly, so the compiler forces every
wrapper author to make a deliberate decision about them instead of inheriting one
silently.
§Examples
use zeph_tools::{ToolExecutor, ToolCall, ToolOutput, ToolError};
struct PassThrough<T> {
inner: T,
}
impl<T: ToolExecutor> ToolExecutor for PassThrough<T> {
async fn execute(&self, response: &str) -> Result<Option<ToolOutput>, ToolError> {
self.inner.execute(response).await
}
fn requires_confirmation(&self, call: &ToolCall) -> bool {
self.inner.requires_confirmation(call)
}
async fn execute_tool_call_confirmed(
&self,
call: &ToolCall,
) -> Result<Option<ToolOutput>, ToolError> {
self.inner.execute_tool_call_confirmed(call).await
}
zeph_tools::tool_executor_forward!(inner);
}