pub struct McpManager { /* private fields */ }Expand description
MCP Manager for managing multiple MCP servers
Implementations§
Source§impl McpManager
impl McpManager
Sourcepub async fn register_server(&self, config: McpServerConfig)
pub async fn register_server(&self, config: McpServerConfig)
Register a server configuration
Sourcepub async fn connect(&self, name: &str) -> Result<()>
pub async fn connect(&self, name: &str) -> Result<()>
Connect to a registered server, recording success or failure internally.
On success the stored error (if any) is cleared; on failure the error
message is stored and visible via McpManager::get_status.
Sourcepub async fn disconnect(&self, name: &str) -> Result<()>
pub async fn disconnect(&self, name: &str) -> Result<()>
Disconnect from a server
Sourcepub async fn all_configs(&self) -> Vec<McpServerConfig>
pub async fn all_configs(&self) -> Vec<McpServerConfig>
Get all registered server configurations
Sourcepub async fn get_all_tools(&self) -> Vec<(String, McpTool)>
pub async fn get_all_tools(&self) -> Vec<(String, McpTool)>
Get all MCP tools, grouped by server name.
Returns (server_name, tool) pairs — the caller is responsible for
constructing the mcp__<server>__<tool> prefix (e.g. via [create_mcp_tools]).
Sourcepub async fn call_tool(
&self,
full_name: &str,
arguments: Option<Value>,
) -> Result<CallToolResult>
pub async fn call_tool( &self, full_name: &str, arguments: Option<Value>, ) -> Result<CallToolResult>
Call an MCP tool by full name
Full name format: mcp__<server>__<tool>
Sourcepub async fn get_status(&self) -> HashMap<String, McpServerStatus>
pub async fn get_status(&self) -> HashMap<String, McpServerStatus>
Get status of all servers
Sourcepub async fn is_connected(&self, name: &str) -> bool
pub async fn is_connected(&self, name: &str) -> bool
Check if a server is connected
Sourcepub async fn list_connected(&self) -> Vec<String>
pub async fn list_connected(&self) -> Vec<String>
List connected server names
Sourcepub async fn get_server_tools(&self, name: &str) -> Vec<McpTool>
pub async fn get_server_tools(&self, name: &str) -> Vec<McpTool>
Get cached tools for a specific connected server.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for McpManager
impl !RefUnwindSafe for McpManager
impl Send for McpManager
impl Sync for McpManager
impl Unpin for McpManager
impl UnsafeUnpin for McpManager
impl !UnwindSafe for McpManager
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