pub struct ToolRegistry { /* private fields */ }Expand description
Immutable-name registry and capability gate for tools.
Implementations§
Source§impl ToolRegistry
impl ToolRegistry
Sourcepub fn register(
&mut self,
tool: Arc<dyn Tool>,
) -> Result<(), ToolRegistrationError>
pub fn register( &mut self, tool: Arc<dyn Tool>, ) -> Result<(), ToolRegistrationError>
Registers a tool without replacing an existing name.
§Errors
Returns ToolRegistrationError for blank or duplicate names.
Sourcepub fn model_specs(&self) -> Vec<ToolSpec>
pub fn model_specs(&self) -> Vec<ToolSpec>
Returns model-facing specifications in deterministic name order.
Sourcepub fn descriptor(&self, name: &str) -> Option<&ToolDescriptor>
pub fn descriptor(&self, name: &str) -> Option<&ToolDescriptor>
Returns the immutable descriptor registered under name.
Sourcepub fn invoke<'a>(
&'a self,
name: &'a str,
input: Value,
run: &'a RunContext,
) -> ToolFuture<'a, Result<ToolOutput, ToolError>>
pub fn invoke<'a>( &'a self, name: &'a str, input: Value, run: &'a RunContext, ) -> ToolFuture<'a, Result<ToolOutput, ToolError>>
Invokes a registered tool after checking the owning run’s explicit capability grant.
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