pub struct ToolRegistry { /* private fields */ }Expand description
Registry of tools available to an agent.
Implementations§
Source§impl ToolRegistry
impl ToolRegistry
Sourcepub fn register(&mut self, tool: Arc<dyn Tool>) -> Result<&mut Self, String>
pub fn register(&mut self, tool: Arc<dyn Tool>) -> Result<&mut Self, String>
Register a tool, compiling its schemas; duplicate or invalid tools are rejected.
Sourcepub fn extend(&mut self, other: &Self) -> Result<(), String>
pub fn extend(&mut self, other: &Self) -> Result<(), String>
Merge another registry; conflicting names are rejected.
Sourcepub fn contains(&self, name: &str) -> bool
pub fn contains(&self, name: &str) -> bool
Whether name (internal or model form) is registered.
Sourcepub fn get(&self, name: &str) -> Option<Arc<dyn Tool>>
pub fn get(&self, name: &str) -> Option<Arc<dyn Tool>>
Look up a tool by internal or model name.
Sourcepub fn validate_arguments(
&self,
name: &str,
arguments: &Value,
) -> Result<(), String>
pub fn validate_arguments( &self, name: &str, arguments: &Value, ) -> Result<(), String>
Validate arguments against the tool’s schema.
Sourcepub fn validate_output(&self, name: &str, output: &Value) -> Result<(), String>
pub fn validate_output(&self, name: &str, output: &Value) -> Result<(), String>
Validate a result against the tool’s output schema.
Sourcepub fn names(&self) -> Vec<&str>
pub fn names(&self) -> Vec<&str>
Stable tool names for validation, diagnostics, and capability policy.
Sourcepub fn confirmation_required_names(&self) -> impl Iterator<Item = &str>
pub fn confirmation_required_names(&self) -> impl Iterator<Item = &str>
Tools whose metadata requires confirmation.
Sourcepub fn filtered<'a>(&self, allowed: impl IntoIterator<Item = &'a str>) -> Self
pub fn filtered<'a>(&self, allowed: impl IntoIterator<Item = &'a str>) -> Self
Return a registry containing only explicitly allowed tools.
Sourcepub fn specs(&self) -> Vec<LlmTool>
pub fn specs(&self) -> Vec<LlmTool>
LLM-facing tool specs for the tools field of a completion request.
Sourcepub fn runtime_manifest(&self) -> Result<Vec<Value>, String>
pub fn runtime_manifest(&self) -> Result<Vec<Value>, String>
Stable implementation and execution contract persisted by profile revisions.
Sourcepub fn suggest_name(&self, name: &str) -> Option<&str>
pub fn suggest_name(&self, name: &str) -> Option<&str>
Best-effort canonical name for case mistakes or an alphabetic junk prefix glued to a registered tool name.
Sourcepub async fn execute_with_context(
&self,
name: &str,
context: &ToolExecutionContext,
args: Value,
) -> Result<Value, String>
pub async fn execute_with_context( &self, name: &str, context: &ToolExecutionContext, args: Value, ) -> Result<Value, String>
Validate, execute and validate the result of one tool call.
Sourcepub fn canonical_name<'a>(&'a self, name: &'a str) -> Option<&'a str>
pub fn canonical_name<'a>(&'a self, name: &'a str) -> Option<&'a str>
Internal name for an internal or model-facing name.
Trait Implementations§
Source§impl Clone for ToolRegistry
impl Clone for ToolRegistry
Source§fn clone(&self) -> ToolRegistry
fn clone(&self) -> ToolRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more