pub struct OverlayToolExecutor { /* private fields */ }Expand description
Tool executor that overlays a single tool on top of an existing executor.
This is used to add server-only tools (like SubAgent) without mutating the
underlying built-in/MCP executor.
Implementations§
Source§impl OverlayToolExecutor
impl OverlayToolExecutor
pub fn new( base: Arc<dyn ToolExecutor>, overlay: Arc<dyn Tool>, ) -> OverlayToolExecutor
Trait Implementations§
Source§impl ToolExecutor for OverlayToolExecutor
impl ToolExecutor for OverlayToolExecutor
Source§fn check_permissions_for<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
call: &'life1 ToolCall,
ctx: &'life2 ToolExecutionContext<'life3>,
) -> Pin<Box<dyn Future<Output = Result<Option<ToolOutcome>, ToolError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
OverlayToolExecutor: 'async_trait,
fn check_permissions_for<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
call: &'life1 ToolCall,
ctx: &'life2 ToolExecutionContext<'life3>,
) -> Pin<Box<dyn Future<Output = Result<Option<ToolOutcome>, ToolError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
OverlayToolExecutor: 'async_trait,
Delegate the permission gate to the base executor so stacked overlays chain down to the built-in executor’s real check (issue #341). A wrapper must never silently answer “allowed” — it defers to whatever it wraps.
Source§fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
call: &'life1 ToolCall,
) -> Pin<Box<dyn Future<Output = Result<ToolResult, ToolError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
OverlayToolExecutor: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
call: &'life1 ToolCall,
) -> Pin<Box<dyn Future<Output = Result<ToolResult, ToolError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
OverlayToolExecutor: 'async_trait,
Executes a tool call Read more
Source§fn execute_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
call: &'life1 ToolCall,
ctx: ToolExecutionContext<'life2>,
) -> Pin<Box<dyn Future<Output = Result<ToolResult, ToolError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
OverlayToolExecutor: 'async_trait,
fn execute_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
call: &'life1 ToolCall,
ctx: ToolExecutionContext<'life2>,
) -> Pin<Box<dyn Future<Output = Result<ToolResult, ToolError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
OverlayToolExecutor: 'async_trait,
Executes a tool call with streaming-capable context. Read more
Source§fn execute_with_context_outcome<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
call: &'life1 ToolCall,
ctx: ToolExecutionContext<'life2>,
) -> Pin<Box<dyn Future<Output = Result<ToolOutcome, ToolError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
OverlayToolExecutor: 'async_trait,
fn execute_with_context_outcome<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
call: &'life1 ToolCall,
ctx: ToolExecutionContext<'life2>,
) -> Pin<Box<dyn Future<Output = Result<ToolOutcome, ToolError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
OverlayToolExecutor: 'async_trait,
Outcome-aware dispatch: returns the tool’s
ToolOutcome rather than the
collapsed ToolResult, so the agent loop can branch on
Completed/Running/NeedsHuman directly instead of sniffing markers on
a result. The default collapses via the execute_with_context path
(always Completed), so executors that never surface Running/NeedsHuman
(composition, MCP, tests) need no override; the built-in + overlay
executors override this to return the real outcome.Source§fn list_tools(&self) -> Vec<ToolSchema>
fn list_tools(&self) -> Vec<ToolSchema>
Lists all available tools and their schemas Read more
Source§fn tool_guidance(&self) -> Option<String>
fn tool_guidance(&self) -> Option<String>
Server-level usage guidance to surface in the system prompt for whatever
this executor currently exposes — e.g. the
instructions an MCP server
returns from initialize. Because it is derived from the live executor,
the text is naturally scoped to what is actually connected/loaded for the
run (a disconnected server contributes nothing). Read moreSource§fn tool_mutability(&self, tool_name: &str) -> ToolMutability
fn tool_mutability(&self, tool_name: &str) -> ToolMutability
Returns mutability metadata for a tool name when available.
Executors that can inspect concrete tools should override this.
Source§fn call_mutability(&self, call: &ToolCall) -> ToolMutability
fn call_mutability(&self, call: &ToolCall) -> ToolMutability
Returns mutability metadata for a specific tool call when available.
Defaults to name-based classification.
Source§fn tool_concurrency_safe(&self, tool_name: &str) -> bool
fn tool_concurrency_safe(&self, tool_name: &str) -> bool
Returns whether a tool can safely execute in parallel with other
read-only tools. Executors that can inspect concrete tools should
override this. Fallback keeps current behavior for known read-only tools.
Source§fn call_concurrency_safe(&self, call: &ToolCall) -> bool
fn call_concurrency_safe(&self, call: &ToolCall) -> bool
Returns whether a specific tool call can safely run in parallel.
Defaults to the tool-name level classification.
Source§fn call_parallel_classification(
&self,
call: &ToolCall,
) -> (ToolMutability, bool)
fn call_parallel_classification( &self, call: &ToolCall, ) -> (ToolMutability, bool)
Classify a tool call’s mutability AND concurrency-safety together,
returning
(mutability, concurrency_safe). Read moreAuto Trait Implementations§
impl !RefUnwindSafe for OverlayToolExecutor
impl !UnwindSafe for OverlayToolExecutor
impl Freeze for OverlayToolExecutor
impl Send for OverlayToolExecutor
impl Sync for OverlayToolExecutor
impl Unpin for OverlayToolExecutor
impl UnsafeUnpin for OverlayToolExecutor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more