pub struct ToolRegistry { /* private fields */ }Expand description
Registry of available tools for the agent loop.
Implementations§
Source§impl ToolRegistry
impl ToolRegistry
Sourcepub fn register(&mut self, spec: ToolSpec)
pub fn register(&mut self, spec: ToolSpec)
Register a tool. Overwrites any existing tool with the same name.
Sourcepub async fn call(
&self,
name: &str,
args: Value,
) -> Result<Value, AgentRuntimeError>
pub async fn call( &self, name: &str, args: Value, ) -> Result<Value, AgentRuntimeError>
Call a tool by name.
§Returns
Ok(Value)— tool resultErr(AgentRuntimeError::AgentLoop)— if the tool is not found or required fields are missingErr(AgentRuntimeError::CircuitOpen)— if the tool’s circuit breaker is open
Sourcepub fn tool_names(&self) -> Vec<&str>
pub fn tool_names(&self) -> Vec<&str>
Return the list of registered tool names.
Trait Implementations§
Source§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 Freeze for ToolRegistry
impl !RefUnwindSafe for ToolRegistry
impl Send for ToolRegistry
impl Sync for ToolRegistry
impl Unpin for ToolRegistry
impl UnsafeUnpin for ToolRegistry
impl !UnwindSafe 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