pub struct ToolRegistry { /* private fields */ }Implementations§
Source§impl ToolRegistry
impl ToolRegistry
pub fn new() -> Self
Sourcepub async fn register(&self, tool: Box<dyn Tool>)
pub async fn register(&self, tool: Box<dyn Tool>)
Register a tool (async, acquires write lock).
Sourcepub fn register_sync(&mut self, tool: Box<dyn Tool>)
pub fn register_sync(&mut self, tool: Box<dyn Tool>)
Register a tool synchronously (for use during startup when we have exclusive access).
This bypasses the RwLock by using get_mut() which requires &mut self.
Sourcepub async fn get_definitions(&self) -> Vec<ToolDef>
pub async fn get_definitions(&self) -> Vec<ToolDef>
Get all tool definitions (async, acquires read lock).
Sourcepub async fn get(&self, name: &str) -> Option<Arc<dyn Tool>>
pub async fn get(&self, name: &str) -> Option<Arc<dyn Tool>>
Get a tool by name (async, acquires read lock).
Sourcepub async fn iter(&self) -> impl Iterator<Item = (String, Arc<dyn Tool>)>
pub async fn iter(&self) -> impl Iterator<Item = (String, Arc<dyn Tool>)>
Iterate over all registered tools (async, acquires read lock).
Sourcepub async fn register_arc(&self, name: String, tool: Arc<dyn Tool>)
pub async fn register_arc(&self, name: String, tool: Arc<dyn Tool>)
Register a tool from an Arc (for building filtered registries from parent).
Sourcepub async fn expected_top_keys(&self, name: &str) -> Vec<String>
pub async fn expected_top_keys(&self, name: &str) -> Vec<String>
Top-level property names declared in the tool’s parameters schema.
Used by recover_tool_args to decide whether a payload needs
wrapper unwrapping. Returns empty Vec if the tool isn’t registered
or the schema doesn’t expose properties (in which case
recover_tool_args falls back to its permissive branch).
Sourcepub async fn unregister_prefix(&self, prefix: &str) -> usize
pub async fn unregister_prefix(&self, prefix: &str) -> usize
Unregister all tools whose names start with prefix.
Used by /mcp reload to drop all previously registered MCP tools
(mcp__{server}__{tool}) before reconnecting/re-registering.
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more