pub struct ToolRegistry { /* private fields */ }Expand description
Registry of named Tools. Cheap to clone (Arc-backed).
Implementations§
Source§impl ToolRegistry
impl ToolRegistry
pub fn new() -> Self
pub fn register(&self, tool: Arc<dyn Tool>)
Sourcepub fn scoped<I, S>(&self, names: I) -> Self
pub fn scoped<I, S>(&self, names: I) -> Self
Return a new registry view restricted to names. The underlying
tools are shared; only the whitelist differs.
pub fn get(&self, name: &str) -> Result<Arc<dyn Tool>, KernelError>
Sourcepub async fn invoke(
&self,
name: &str,
args: Value,
) -> Result<Value, KernelError>
pub async fn invoke( &self, name: &str, args: Value, ) -> Result<Value, KernelError>
Convenience: look up name and invoke it.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn schemas(&self) -> Vec<ToolSchema>
pub fn schemas(&self) -> Vec<ToolSchema>
Snapshot of every visible tool’s schema. Honours the allowed
whitelist when present. Used by the MCP loopback transport to
surface a server-side registry to a client.
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 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