MCPcopy Index your code
hub / github.com/AI45Lab/Code / disconnect_idle_mcp

Method disconnect_idle_mcp

sdk/python/src/lib.rs:1405–1410  ·  view source on GitHub ↗

Disconnect every global MCP server idle longer than ``idle_threshold_ms``, returning the names disconnected. The server's registered config is kept — a later tool call reconnects on demand. Call periodically (e.g. every 60s with a 5-min threshold) from a host-side sweeper to release file descriptors and background workers from quiet MCP servers in long-running deployments.

(&self, py: Python<'_>, idle_threshold_ms: u64)

Source from the content-addressed store, hash-verified

1403 /// and background workers from quiet MCP servers in long-running
1404 /// deployments.
1405 fn disconnect_idle_mcp(&self, py: Python<'_>, idle_threshold_ms: u64) -> Vec<String> {
1406 let agent = self.inner.clone();
1407 py.allow_threads(move || {
1408 get_runtime().block_on(agent.disconnect_idle_mcp(idle_threshold_ms))
1409 })
1410 }
1411}
1412
1413// ============================================================================

Callers 1

mainFunction · 0.45

Calls 3

block_onMethod · 0.80
get_runtimeFunction · 0.70
cloneMethod · 0.45

Tested by 1

mainFunction · 0.36