Skip to main content

CatalogWriter

Struct CatalogWriter 

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

Mutating side of a dynamic tool catalog. Owned by subsystems that discover or refresh tools at runtime (MCP server manager, skill watcher, plugin loader). Each upsert, remove, or replace_all emits a ToolCatalogEvent that every CatalogReader minted from the same dynamic_catalog call (or its clones) observes via ToolSource::drain_catalog_events.

Implementations§

Source§

impl CatalogWriter

Source

pub fn source_id(&self) -> &str

Stable source identifier appearing on emitted catalog events.

Source

pub fn reader(&self) -> CatalogReader

Mints an additional CatalogReader over the same shared state. The new reader subscribes from now forward — it does not see events emitted before this call.

Source

pub fn upsert(&self, tool: Arc<dyn Tool>)

Inserts or replaces a tool. Emits a single-entry catalog event with the tool’s name in added (new) or changed (replaced).

Source

pub fn remove(&self, name: &ToolName) -> bool

Removes a tool by name. Emits a catalog event with the name in removed if it existed.

Source

pub fn replace_all(&self, tools: impl IntoIterator<Item = Arc<dyn Tool>>)

Atomically replaces the entire tool set. Emits one catalog event describing the diff against the previous contents.

Source

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

Subscribes a fresh broadcast receiver. Lower-level than CatalogReader — for hosts that consume catalog events directly rather than through the loop.

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> 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, 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.