Skip to main content

stop

Method
This is a method of the MCPToolRunner class in the mcp module.
Best-effort teardown for the runner thread. Queues the shutdown sentinel and joins the thread so the request loop exits and its stdio subprocess is terminated instead of leaking a background thread (and its child) across the process lifetime. The request loop reads the sentinel promptly and cancels any in-flight calls, which are answered with an error instead of left waiting.

Signature

Parameters

Any
Seconds to wait for the thread to exit. Defaults to the runner’s own operation timeout so an in-flight call has a chance to finish before we give up. The thread is a daemon, so this never blocks interpreter exit even if the join times out.

Returns

Any
The result of the operation.

Uses

  • put
  • is_set
  • call_soon_threadsafe
  • is_alive

Source

View on GitHub

praisonaiagents/mcp/mcp.py at line 416