pub struct McpLifecycleManager { /* private fields */ }Expand description
Manages the lifecycle of multiple MCP server connections.
Implementations§
Source§impl McpLifecycleManager
impl McpLifecycleManager
Sourcepub async fn register(
&self,
name: impl Into<String>,
transport: impl McpTransport + 'static,
reconnect_delay: Duration,
)
pub async fn register( &self, name: impl Into<String>, transport: impl McpTransport + 'static, reconnect_delay: Duration, )
Register an MCP server under the given name.
Sourcepub async fn start_all(&self) -> Result<(), AgentError>
pub async fn start_all(&self) -> Result<(), AgentError>
Connect all registered, enabled servers.
Sourcepub async fn stop_all(&self) -> Result<(), AgentError>
pub async fn stop_all(&self) -> Result<(), AgentError>
Disconnect all servers cleanly.
Sourcepub async fn enable(&self, name: &str) -> Result<(), AgentError>
pub async fn enable(&self, name: &str) -> Result<(), AgentError>
Enable a specific server (connects if not already connected).
Sourcepub async fn disable(&self, name: &str) -> Result<(), AgentError>
pub async fn disable(&self, name: &str) -> Result<(), AgentError>
Disable a specific server (disconnects immediately).
Sourcepub async fn all_status(&self) -> Vec<McpServerStatus>
pub async fn all_status(&self) -> Vec<McpServerStatus>
Return current status for all managed servers.
Sourcepub async fn list_tools(
&self,
server_name: &str,
) -> Result<Vec<McpToolDescriptor>, AgentError>
pub async fn list_tools( &self, server_name: &str, ) -> Result<Vec<McpToolDescriptor>, AgentError>
List tools available from a named server.
Sourcepub async fn call_tool(
&self,
server_name: &str,
tool_name: &str,
arguments: Value,
) -> Result<Value, AgentError>
pub async fn call_tool( &self, server_name: &str, tool_name: &str, arguments: Value, ) -> Result<Value, AgentError>
Invoke a tool on a named server, reconnecting if needed.
Sourcepub fn spawn_health_monitor(self: Arc<Self>, interval: Duration)
pub fn spawn_health_monitor(self: Arc<Self>, interval: Duration)
Spawn a background health-monitor task that reconnects servers that drop.
The task polls every interval and attempts reconnection with the
server’s configured reconnect_delay.
Trait Implementations§
Source§impl Debug for McpLifecycleManager
impl Debug for McpLifecycleManager
Source§impl Default for McpLifecycleManager
impl Default for McpLifecycleManager
Source§fn default() -> McpLifecycleManager
fn default() -> McpLifecycleManager
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for McpLifecycleManager
impl !UnwindSafe for McpLifecycleManager
impl Freeze for McpLifecycleManager
impl Send for McpLifecycleManager
impl Sync for McpLifecycleManager
impl Unpin for McpLifecycleManager
impl UnsafeUnpin for McpLifecycleManager
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