pub trait PermissionChecker: Send + Sync {
// Required method
fn check(&self, tool_name: &str, args: &Value) -> PermissionDecision;
// Provided method
fn expose_to_model(&self, _tool_name: &str) -> bool { ... }
}Expand description
Trait for checking tool execution permissions.
Implement this trait to provide custom permission logic.
The built-in PermissionPolicy implements this trait using
declarative allow/deny/ask rules with pattern matching.
Required Methods§
Sourcefn check(&self, tool_name: &str, args: &Value) -> PermissionDecision
fn check(&self, tool_name: &str, args: &Value) -> PermissionDecision
Check whether a tool invocation is allowed, denied, or requires confirmation.
Provided Methods§
Sourcefn expose_to_model(&self, _tool_name: &str) -> bool
fn expose_to_model(&self, _tool_name: &str) -> bool
Whether a tool definition should be exposed to the model.
This controls model-visible capabilities only. Self::check remains
the authoritative execution-time decision for any tool invocation.
Existing checkers expose every tool unless they explicitly override
this method.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".