pub struct Registry { /* private fields */ }
Expand description
A registry for discovering, storing, and retrieving tools and agents.
The Registry
is responsible for loading tools and agents from the filesystem
and providing a central place to access them by name.
Implementations§
Source§impl Registry
impl Registry
Sourcepub async fn load_tools(&mut self, tool_dirs: &[PathBuf]) -> Result<()>
pub async fn load_tools(&mut self, tool_dirs: &[PathBuf]) -> Result<()>
Loads all tools from the specified directories.
This method scans the provided directories for supported script files
(e.g., .sh
, .js
, .py
) and loads them as Tool
s.
Sourcepub async fn load_agents(&mut self, agent_dirs: &[PathBuf]) -> Result<()>
pub async fn load_agents(&mut self, agent_dirs: &[PathBuf]) -> Result<()>
Loads all agents from the specified directories.
This method scans the provided directories for agent definitions and loads them into the registry.
Sourcepub fn get_tool(&self, name: &str) -> Option<&Tool>
pub fn get_tool(&self, name: &str) -> Option<&Tool>
Retrieves a reference to a tool by its name.
Sourcepub fn get_agent(&self, name: &str) -> Option<&Agent>
pub fn get_agent(&self, name: &str) -> Option<&Agent>
Retrieves a reference to an agent by its name.
Sourcepub fn list_tools(&self) -> Vec<String>
pub fn list_tools(&self) -> Vec<String>
Returns a list of names of all registered tools.
Sourcepub fn list_agents(&self) -> Vec<String>
pub fn list_agents(&self) -> Vec<String>
Returns a list of names of all registered agents.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Registry
impl RefUnwindSafe for Registry
impl Send for Registry
impl Sync for Registry
impl Unpin for Registry
impl UnwindSafe for Registry
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
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>
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