pub struct McpPool { /* private fields */ }Expand description
Pool of MCP connections for reuse
Implementations§
Source§impl McpPool
impl McpPool
Sourcepub fn from_config_path(path: &Path) -> Result<Self>
pub fn from_config_path(path: &Path) -> Result<Self>
Create a pool from a configuration file path
Sourcepub fn with_network_policy(self, policy: NetworkPolicyDecider) -> Self
pub fn with_network_policy(self, policy: NetworkPolicyDecider) -> Self
Attach a per-domain network policy (#135). When set, HTTP/SSE transports are gated through it; STDIO transports are unaffected.
Sourcepub async fn get_or_connect(
&mut self,
server_name: &str,
) -> Result<&mut McpConnection>
pub async fn get_or_connect( &mut self, server_name: &str, ) -> Result<&mut McpConnection>
Get or create a connection to a server
Sourcepub async fn connect_all(&mut self) -> Vec<(String, Error)>
pub async fn connect_all(&mut self) -> Vec<(String, Error)>
Connect to all enabled servers, returning errors for failed connections
Sourcepub fn all_tools(&self) -> Vec<(String, &McpTool)>
pub fn all_tools(&self) -> Vec<(String, &McpTool)>
Get all discovered tools with server-prefixed names
Sourcepub fn all_resources(&self) -> Vec<(String, &McpResource)>
pub fn all_resources(&self) -> Vec<(String, &McpResource)>
Get all discovered resources with server-prefixed names
Sourcepub fn all_resource_templates(&self) -> Vec<(String, &McpResourceTemplate)>
pub fn all_resource_templates(&self) -> Vec<(String, &McpResourceTemplate)>
Get all discovered resource templates with server-prefixed names
Sourcepub fn all_prompts(&self) -> Vec<(String, &McpPrompt)>
pub fn all_prompts(&self) -> Vec<(String, &McpPrompt)>
Get all discovered prompts with server-prefixed names
Sourcepub async fn read_resource(
&mut self,
server_name: &str,
uri: &str,
) -> Result<Value>
pub async fn read_resource( &mut self, server_name: &str, uri: &str, ) -> Result<Value>
Read a resource from a specific server
Sourcepub async fn get_prompt(
&mut self,
server_name: &str,
prompt_name: &str,
arguments: Value,
) -> Result<Value>
pub async fn get_prompt( &mut self, server_name: &str, prompt_name: &str, arguments: Value, ) -> Result<Value>
Get a prompt from a specific server
Sourcepub fn to_api_tools(&self) -> Vec<Tool>
pub fn to_api_tools(&self) -> Vec<Tool>
Convert discovered tools to API Tool format
Sourcepub async fn call_tool(
&mut self,
prefixed_name: &str,
arguments: Value,
) -> Result<Value>
pub async fn call_tool( &mut self, prefixed_name: &str, arguments: Value, ) -> Result<Value>
Call a tool by its prefixed name (mcp_{server}_{tool})
Sourcepub fn server_names(&self) -> Vec<&str>
pub fn server_names(&self) -> Vec<&str>
Get list of configured server names
Sourcepub fn connected_servers(&self) -> Vec<&str>
pub fn connected_servers(&self) -> Vec<&str>
Get list of connected server names
Sourcepub fn disconnect_all(&mut self)
pub fn disconnect_all(&mut self)
Disconnect all connections
Sourcepub async fn reload_from_path(&mut self, path: &Path) -> Result<McpReloadReport>
pub async fn reload_from_path(&mut self, path: &Path) -> Result<McpReloadReport>
Reload pool configuration from disk and reconcile live connections.
Sourcepub async fn reload_config(
&mut self,
new_config: McpConfig,
reconnect: bool,
) -> McpReloadReport
pub async fn reload_config( &mut self, new_config: McpConfig, reconnect: bool, ) -> McpReloadReport
Apply a new config: drop removed/changed/disabled connections, swap config, then optionally reconnect all enabled servers.
Sourcepub async fn shutdown_all(&mut self)
pub async fn shutdown_all(&mut self)
Graceful shutdown of every connection in the pool: send SIGTERM to each stdio child and give them a short grace period before drop fires SIGKILL. Whalescale#420.
Call from the TUI exit path before dropping the pool to give
MCP servers a chance to flush state. The fallback Drop on
StdioTransport still sends SIGTERM if this never runs, so even
abnormal exits avoid leaking PIDs without a signal.
Sourcepub fn is_mcp_tool(name: &str) -> bool
pub fn is_mcp_tool(name: &str) -> bool
Check if a tool name is an MCP tool
Trait Implementations§
Source§impl McpHost for McpPool
impl McpHost for McpPool
Source§fn is_mcp_tool(&self, name: &str) -> bool
fn is_mcp_tool(&self, name: &str) -> bool
Source§fn tool_is_parallel_safe(&self, name: &str) -> bool
fn tool_is_parallel_safe(&self, name: &str) -> bool
name may run inside the parallel batch
executor (read-only + side-effect-free). Read more