MCPcopy Create free account
hub / github.com/AI45Lab/Code / disconnect_idle_mcp

Method disconnect_idle_mcp

core/src/agent_api.rs:497–502  ·  view source on GitHub ↗

Disconnect every global MCP server whose last activity is older than `idle_threshold_ms`. Returns the names of disconnected servers (empty when there is no global MCP manager or when nothing is idle). Hosts running thousands of long-lived sessions should call this periodically (e.g. every 60s with a 5-min threshold) to release file descriptors and background workers from quiet MCP servers without

(&self, idle_threshold_ms: u64)

Source from the content-addressed store, hash-verified

495 /// without losing the server's configuration. A subsequent tool
496 /// call on the same server will require an explicit reconnect.
497 pub async fn disconnect_idle_mcp(&self, idle_threshold_ms: u64) -> Vec<String> {
498 match &self.global_mcp {
499 Some(mcp) => mcp.disconnect_idle(idle_threshold_ms).await,
500 None => Vec::new(),
501 }
502 }
503
504 #[cfg(test)]
505 fn build_session(

Calls 1

disconnect_idleMethod · 0.80