pub struct Registry { /* private fields */ }Expand description
Thread-safe registry of callable tools.
Optionally wires the HITL stages (per locked decision D10):
sensitivity → (if RequireApproval) human approval → invoke.
The authorization stage is owned by the boundary (rskit-mcp, etc.) and is not enforced here;
this preserves module layering.
Implementations§
Source§impl Registry
impl Registry
Sourcepub fn with_sensitivity_evaluator(
self,
evaluator: Arc<dyn SensitivityEvaluator>,
) -> Self
pub fn with_sensitivity_evaluator( self, evaluator: Arc<dyn SensitivityEvaluator>, ) -> Self
Inject a sensitivity evaluator. When unset, no sensitivity checks run.
Sourcepub fn with_human_approval(self, approval: Arc<dyn HumanApproval>) -> Self
pub fn with_human_approval(self, approval: Arc<dyn HumanApproval>) -> Self
Inject a human-approval gate. When unset, RequireApproval decisions are treated as denials.
Sourcepub fn register(&self, tool: Box<dyn Callable>) -> AppResult<()>
pub fn register(&self, tool: Box<dyn Callable>) -> AppResult<()>
Register a tool. Returns error on empty name or duplicate.
Sourcepub fn list(&self) -> Vec<Definition>
pub fn list(&self) -> Vec<Definition>
List all registered tool definitions.
Sourcepub async fn call(
&self,
name: &str,
ctx: &Context,
input: ToolInput,
) -> AppResult<ToolResult>
pub async fn call( &self, name: &str, ctx: &Context, input: ToolInput, ) -> AppResult<ToolResult>
Call a tool by name with a context. Runs the HITL stages (sensitivity → human approval) if configured before invoking the tool.
Sourcepub async fn call_validated(
&self,
name: &str,
ctx: &Context,
input: ToolInput,
) -> AppResult<ToolResult>
pub async fn call_validated( &self, name: &str, ctx: &Context, input: ToolInput, ) -> AppResult<ToolResult>
Call a tool after the caller has already validated the input schema.
This still runs HITL stages before invoking the tool,
but skips the schema validation pass performed by Registry::call.
Sourcepub fn search(&self, query: &str) -> Vec<Definition>
pub fn search(&self, query: &str) -> Vec<Definition>
Search for tools whose name or description contains the query (case-insensitive).
Sourcepub fn filter_by_execution_hint(&self, hint: ExecutionHint) -> Vec<Definition>
pub fn filter_by_execution_hint(&self, hint: ExecutionHint) -> Vec<Definition>
Filter tools by execution_hint annotation.
Sourcepub async fn call_batch(
&self,
calls: Vec<(&str, ToolInput)>,
ctx: &Context,
options: BatchOptions,
) -> Vec<AppResult<ToolResult>> ⓘ
pub async fn call_batch( &self, calls: Vec<(&str, ToolInput)>, ctx: &Context, options: BatchOptions, ) -> Vec<AppResult<ToolResult>> ⓘ
Call multiple tools with caller-supplied concurrency policy.
Each call goes through the same HITL stages as Registry::call.