Skip to main content

CatalogReader

Struct CatalogReader 

Source
pub struct CatalogReader { /* private fields */ }
Expand description

Read side of a dynamic tool catalog. Implements ToolSource and is the value handed to [agentkit_loop::AgentBuilder::tools]. Cloning subscribes a fresh broadcast receiver, so independent observers don’t compete for catalog events.

Implementations§

Source§

impl CatalogReader

Source

pub fn source_id(&self) -> &str

Stable source identifier appearing on emitted catalog events.

Source

pub fn subscribe(&self) -> Receiver<ToolCatalogEvent>

Subscribes a fresh broadcast receiver — equivalent to CatalogWriter::subscribe.

Trait Implementations§

Source§

impl Clone for CatalogReader

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ToolSource for CatalogReader

Source§

fn specs(&self) -> Vec<ToolSpec>

Returns the current spec for every tool in this source.
Source§

fn get(&self, name: &ToolName) -> Option<Arc<dyn Tool>>

Looks up a tool by name, returning None if not present.
Source§

fn drain_catalog_events(&self) -> Vec<ToolCatalogEvent>

Drains pending catalog change events. Static sources return an empty list; dynamic sources surface added/removed/changed batches that the loop forwards to the model on the next turn.
Source§

fn prefixed(self, prefix: impl Into<String>) -> Prefixed<Self>
where Self: Sized,

Wraps this source so every advertised tool name is prefixed with <prefix>_. Useful for mounting the same source under multiple namespaces, or for avoiding collisions between MCP catalogs. Read more
Source§

fn filtered<F>(self, predicate: F) -> Filtered<Self, F>
where Self: Sized, F: Fn(&ToolName) -> bool + Send + Sync + 'static,

Wraps this source so only tools whose name passes predicate are advertised and resolvable. Tools rejected by the predicate are invisible to the model and return None on lookup. Read more
Source§

fn renamed<I>(self, mapping: I) -> Renamed<Self>
where Self: Sized, I: IntoIterator<Item = (ToolName, ToolName)>,

Wraps this source with a name remapping. Each (original, new) pair in mapping causes the tool to be advertised as new and resolved from new back to original on lookup. Tools not in the mapping pass through unchanged. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.