Struct McpToolRegistryManager
pub struct McpToolRegistryManager { /* private fields */ }Expand description
Dynamic MCP registry manager.
Keeps server transports alive and refreshes discovered tool definitions
into a shared snapshot consumed by McpToolRegistry.
Implementations§
§impl McpToolRegistryManager
impl McpToolRegistryManager
pub async fn connect( configs: impl IntoIterator<Item = McpServerConnectionConfig>, ) -> Result<McpToolRegistryManager, McpToolRegistryError>
pub async fn connect_with_sampling(
configs: impl IntoIterator<Item = McpServerConnectionConfig>,
sampling_handler: Option<Arc<dyn SamplingHandler>>,
) -> Result<McpToolRegistryManager, McpToolRegistryError>
pub async fn connect_with_sampling( configs: impl IntoIterator<Item = McpServerConnectionConfig>, sampling_handler: Option<Arc<dyn SamplingHandler>>, ) -> Result<McpToolRegistryManager, McpToolRegistryError>
Connect to MCP servers with an optional sampling handler.
When sampling_handler is provided, the client declares sampling
capability during initialization and routes incoming
sampling/createMessage requests from MCP servers to this handler.
pub async fn from_transports( entries: impl IntoIterator<Item = (McpServerConnectionConfig, Arc<dyn McpToolTransport>)>, ) -> Result<McpToolRegistryManager, McpToolRegistryError>
pub async fn refresh(&self) -> Result<u64, McpToolRegistryError>
pub async fn refresh(&self) -> Result<u64, McpToolRegistryError>
Refresh all MCP tool definitions atomically.
On failure, the previously published snapshot is preserved.
pub fn start_periodic_refresh(
&self,
interval: Duration,
) -> Result<(), McpToolRegistryError>
pub fn start_periodic_refresh( &self, interval: Duration, ) -> Result<(), McpToolRegistryError>
Start background periodic refresh.
The first refresh tick runs after interval.
pub async fn stop_periodic_refresh(&self) -> bool
pub async fn stop_periodic_refresh(&self) -> bool
Stop the background periodic refresh loop.
Returns true if a running loop existed.
pub fn periodic_refresh_running(&self) -> bool
pub fn periodic_refresh_running(&self) -> bool
Whether periodic refresh loop is running.
pub fn registry(&self) -> McpToolRegistry
pub fn registry(&self) -> McpToolRegistry
Get the tool-registry view backed by this manager.
pub fn servers(&self) -> Vec<(String, TransportTypeId)>
pub fn refresh_health(&self) -> McpRefreshHealth
Trait Implementations§
§impl Clone for McpToolRegistryManager
impl Clone for McpToolRegistryManager
§fn clone(&self) -> McpToolRegistryManager
fn clone(&self) -> McpToolRegistryManager
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for McpToolRegistryManager
impl !RefUnwindSafe for McpToolRegistryManager
impl Send for McpToolRegistryManager
impl Sync for McpToolRegistryManager
impl Unpin for McpToolRegistryManager
impl !UnwindSafe for McpToolRegistryManager
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