shutdown • AI Agent SDK

shutdown: Signal the thread to shut down.

shutdown

Method

</div>

This is a method of the MCPToolRunner class in the mcp module.

Signal the thread to shut down.

Queues a sentinel that the request loop consumes to exit cleanly. This only takes effect once initialization has completed and the loop is running; use :meth:stop for a best-effort teardown when init never finished (e.g. a timed-out handshake) so the daemon thread and its stdio child do not leak across construction retries (issue #4375).

Signature

python
def shutdown() -> Any

Returns

ResponseField Any

The result of the operation.

Uses

  • put

Used By

Source

View on GitHub

praisonaiagents/mcp/mcp.py at line 405