pub struct HubConnections { /* private fields */ }Expand description
Managed hub connections with shared infrastructure.
Implementations§
Source§impl HubConnections
impl HubConnections
Sourcepub async fn connect(
&self,
config: McpServerConnectionConfig,
) -> Result<Arc<ManagedConnection>, McpTransportError>
pub async fn connect( &self, config: McpServerConnectionConfig, ) -> Result<Arc<ManagedConnection>, McpTransportError>
Establish a connection to a server.
Sourcepub async fn establish_connection(
&self,
conn: &ManagedConnection,
) -> Result<(), McpTransportError>
pub async fn establish_connection( &self, conn: &ManagedConnection, ) -> Result<(), McpTransportError>
Establish or re-establish a connection.
Sourcepub fn get(&self, server_name: &str) -> Option<Arc<ManagedConnection>>
pub fn get(&self, server_name: &str) -> Option<Arc<ManagedConnection>>
Get a connection by server name.
Sourcepub fn server_for_tool(&self, tool_name: &str) -> Option<String>
pub fn server_for_tool(&self, tool_name: &str) -> Option<String>
Get server name for a tool.
Sourcepub fn get_tool_definition(&self, tool_name: &str) -> Option<McpToolDefinition>
pub fn get_tool_definition(&self, tool_name: &str) -> Option<McpToolDefinition>
Get tool definition by name.
Sourcepub fn list_servers(&self) -> Vec<String>
pub fn list_servers(&self) -> Vec<String>
List all server names.
Sourcepub fn list_tools(&self) -> Vec<(String, McpToolDefinition)>
pub fn list_tools(&self) -> Vec<(String, McpToolDefinition)>
List all tools with their server names.
Sourcepub fn list_tool_definitions(&self) -> Vec<McpToolDefinition>
pub fn list_tool_definitions(&self) -> Vec<McpToolDefinition>
List all tool definitions.
Sourcepub fn is_connected(&self, server_name: &str) -> bool
pub fn is_connected(&self, server_name: &str) -> bool
Check if a server is connected.
Sourcepub fn clear_tools_for_server(&self, server_name: &str)
pub fn clear_tools_for_server(&self, server_name: &str)
Clear tool cache for a server.
Sourcepub fn iter(
&self,
) -> impl Iterator<Item = (String, Arc<ManagedConnection>)> + '_
pub fn iter( &self, ) -> impl Iterator<Item = (String, Arc<ManagedConnection>)> + '_
Iterate over all connections.
Sourcepub async fn call_tool(
&self,
name: &str,
args: Value,
) -> Result<Value, McpTransportError>
pub async fn call_tool( &self, name: &str, args: Value, ) -> Result<Value, McpTransportError>
Call a tool with circuit breaker and failure handling.
Sourcepub async fn discover_tools_parallel(
&self,
timeout: Duration,
) -> Result<Vec<(String, McpToolDefinition)>, McpTransportError>
pub async fn discover_tools_parallel( &self, timeout: Duration, ) -> Result<Vec<(String, McpToolDefinition)>, McpTransportError>
Discover tools from all servers in parallel.
This is much faster than sequential discovery when connecting to many servers.
Sourcepub async fn refresh_tools_parallel(
&self,
timeout: Duration,
) -> Result<(), McpTransportError>
pub async fn refresh_tools_parallel( &self, timeout: Duration, ) -> Result<(), McpTransportError>
Refresh tool cache from all servers in parallel.
Sourcepub async fn health_check(&self) -> Vec<(String, bool)>
pub async fn health_check(&self) -> Vec<(String, bool)>
Get health status of all servers.
Sourcepub fn circuit_breaker_stats(
&self,
server_name: &str,
) -> Option<CircuitBreakerStats>
pub fn circuit_breaker_stats( &self, server_name: &str, ) -> Option<CircuitBreakerStats>
Get circuit breaker statistics for a server.
Sourcepub fn reset_circuit_breaker(&self, server_name: &str)
pub fn reset_circuit_breaker(&self, server_name: &str)
Reset circuit breaker for a server.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HubConnections
impl !RefUnwindSafe for HubConnections
impl Send for HubConnections
impl Sync for HubConnections
impl Unpin for HubConnections
impl !UnwindSafe for HubConnections
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