pub struct McpDiscoveryManager { /* private fields */ }Expand description
MCP Tool Discovery Manager
Manages connections to external MCP servers, discovers available tools, and caches tool metadata for performance.
Implementations§
Source§impl McpDiscoveryManager
impl McpDiscoveryManager
Sourcepub fn with_cache_ttl(cache_ttl: Duration) -> Self
pub fn with_cache_ttl(cache_ttl: Duration) -> Self
Create with custom cache TTL
Sourcepub fn register_server(&self, config: McpServerConfig)
pub fn register_server(&self, config: McpServerConfig)
Register an MCP server
Sourcepub fn unregister_server(&self, name: &str)
pub fn unregister_server(&self, name: &str)
Unregister an MCP server
Sourcepub fn list_servers(&self) -> Vec<ServerInfo>
pub fn list_servers(&self) -> Vec<ServerInfo>
Get all registered servers
Sourcepub fn get_server(&self, name: &str) -> Option<ServerInfo>
pub fn get_server(&self, name: &str) -> Option<ServerInfo>
Get server info by name
Sourcepub fn update_server_state(
&self,
name: &str,
state: ServerState,
error: Option<String>,
)
pub fn update_server_state( &self, name: &str, state: ServerState, error: Option<String>, )
Update server state
Sourcepub fn cache_tools(&self, server_name: &str, tools: Vec<Tool>)
pub fn cache_tools(&self, server_name: &str, tools: Vec<Tool>)
Cache tools from a server
Sourcepub fn list_tools(&self) -> Vec<CachedTool>
pub fn list_tools(&self) -> Vec<CachedTool>
Get all cached tools
Sourcepub fn get_tool(&self, server_name: &str, tool_name: &str) -> Option<CachedTool>
pub fn get_tool(&self, server_name: &str, tool_name: &str) -> Option<CachedTool>
Get a specific tool by server:name
Sourcepub fn tools_from_server(&self, server_name: &str) -> Vec<CachedTool>
pub fn tools_from_server(&self, server_name: &str) -> Vec<CachedTool>
Get all tools from a specific server
Sourcepub fn clear_expired(&self)
pub fn clear_expired(&self)
Clear expired cache entries
Sourcepub fn clear_cache(&self)
pub fn clear_cache(&self)
Clear all cached tools
Sourcepub fn cache_stats(&self) -> CacheStats
pub fn cache_stats(&self) -> CacheStats
Get cache statistics
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for McpDiscoveryManager
impl RefUnwindSafe for McpDiscoveryManager
impl Send for McpDiscoveryManager
impl Sync for McpDiscoveryManager
impl Unpin for McpDiscoveryManager
impl UnwindSafe for McpDiscoveryManager
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> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().