pub trait ToolExecutor: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn schema(&self) -> Value;
fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn restricted_tiers(&self) -> &[ServiceTier] { ... }
}Expand description
Object-safe executor interface for a single named tool.
Why: Abstracts over all tool kinds (fs, shell, web search, delegate, MCP
bridge) so the registry and dispatch loop are tool-agnostic. New tools drop
in by implementing this trait without touching the PM loop.
What: name() is the string key used in LLM function calls; schema()
emits the JSON function descriptor; execute(args) performs the action.
Test: ToolRegistry tests register a MockTool implementing this trait.
Required Methods§
Provided Methods§
Sourcefn restricted_tiers(&self) -> &[ServiceTier]
fn restricted_tiers(&self) -> &[ServiceTier]
Access tiers that are blocked from calling this tool.
Why: Tools declare which tiers they restrict; an empty list means
universally accessible. This inverted model means adding RBAC to
existing tools is a no-op by default.
What: Returns a slice of ServiceTier values that are NOT allowed.
Test: rbac::tests::can_access_tier_*.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".