Struct ToolRegistry
pub struct ToolRegistry { /* private fields */ }Expand description
Central registry of all available tools (built-ins + user plugins).
Cheaply cloneable via the inner Arc — wrapping in an outer Arc is not
needed in most call sites.
Implementations§
Source§impl ToolRegistry
impl ToolRegistry
pub async fn load(devices: Arc<RwLock<DeviceRegistry>>) -> Result<Self>
pub fn schemas(&self) -> Vec<Value>
Sourcepub async fn dispatch(
&self,
name: &str,
args: Value,
) -> Result<ToolResult, ToolError>
pub async fn dispatch( &self, name: &str, args: Value, ) -> Result<ToolResult, ToolError>
Dispatch a tool call from the LLM.
Looks up the tool by name and delegates to tool.execute(args).
Returns ToolError::UnknownTool when no matching tool is found.
Sourcepub fn device_registry(&self) -> Arc<RwLock<DeviceRegistry>>
pub fn device_registry(&self) -> Arc<RwLock<DeviceRegistry>>
Borrow the device registry (e.g. for introspection or hot-reload).
pub fn into_tools(self) -> Vec<Box<dyn Tool>>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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