pub struct ToolRegistry { /* private fields */ }Expand description
Registry of tools available to an agent.
Implementations§
Source§impl ToolRegistry
impl ToolRegistry
pub fn new() -> Self
pub fn register(&mut self, tool: Arc<dyn Tool>) -> Result<&mut Self, String>
pub fn extend(&mut self, other: &Self) -> Result<(), String>
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
pub fn contains(&self, name: &str) -> bool
pub fn get(&self, name: &str) -> Option<Arc<dyn Tool>>
pub fn validate_arguments( &self, name: &str, arguments: &Value, ) -> Result<(), String>
pub fn validate_output(&self, name: &str, output: &Value) -> Result<(), String>
Sourcepub fn names(&self) -> Vec<&str>
pub fn names(&self) -> Vec<&str>
Stable tool names for validation, diagnostics, and capability policy.
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.
pub async fn execute_with_context( &self, name: &str, context: &ToolExecutionContext, args: Value, ) -> Result<Value, String>
pub fn canonical_name<'a>(&'a self, name: &'a str) -> Option<&'a str>
Trait Implementations§
Source§impl Clone for ToolRegistry
impl Clone for ToolRegistry
Source§fn clone(&self) -> ToolRegistry
fn clone(&self) -> ToolRegistry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ToolRegistry
impl Debug for ToolRegistry
Source§impl Default for ToolRegistry
impl Default for ToolRegistry
Source§fn default() -> ToolRegistry
fn default() -> ToolRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for ToolRegistry
impl !UnwindSafe for ToolRegistry
impl Freeze for ToolRegistry
impl Send for ToolRegistry
impl Sync for ToolRegistry
impl Unpin for ToolRegistry
impl UnsafeUnpin for ToolRegistry
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