Skip to content

Commit ebb173c

Browse files
committed
Correct ClientSession's exception-delivery docstring; list shared.session removal
The class docstring claimed transport exceptions reach message_handler only when the session builds its own dispatcher, but a caller-supplied JSONRPCDispatcher with no stream-exception hook is wired up the same way (the standard Client path), so exceptions arrive on any stream-backed dispatcher. Say that instead. Also add mcp.shared.session and its RequestResponder stub to the removed-import-paths bullet in whats-new. No-Verification-Needed: docstring- and doc-only change
1 parent 9012574 commit ebb173c

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

docs/whats-new.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Each of these is a section in the **[Migration Guide](migration.md)**:
146146

147147
* The **WebSocket transport**, both sides, and the `mcp[ws]` extra. It was never part of the MCP specification.
148148
* The **experimental Tasks** API (`mcp.*.experimental`). 2026-07-28 moves tasks out of the core protocol and into an official extension ([SEP-2663](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2663)), which this SDK does not implement yet.
149-
* `mcp.types`, `mcp.shared.version`, and `mcp.shared.progress` as import paths.
149+
* `mcp.types`, `mcp.shared.version`, `mcp.shared.progress`, and `mcp.shared.session` (with the `RequestResponder` stub v1 `message_handler` annotations imported) as import paths.
150150
* The deprecated `streamablehttp_client` spelling, and the `get_session_id` callback from `streamable_http_client` (which now yields exactly two streams).
151151
* `McpError`, renamed **`MCPError`** with a direct `(code, message, data)` constructor.
152152
* `MCPServer.get_context()`, `mount_path=`, and the lowlevel `Server`'s decorator methods, ContextVar, and handler dicts.

src/mcp/client/session.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,10 @@ class ClientSession:
334334
`dispatcher=`), enter as an async context manager, then call
335335
`initialize()`. The dispatcher owns the receive loop and request
336336
correlation; this class owns the typed MCP layer and the constructor
337-
callbacks. Transport `Exception` items reach `message_handler` only when
338-
the session builds its own dispatcher from a stream pair.
337+
callbacks. Transport `Exception` items reach `message_handler` on any
338+
stream-backed dispatcher (`JSONRPCDispatcher`), whether built here from a
339+
stream pair or supplied without a stream-exception hook of its own; an
340+
in-process `DirectDispatcher` carries none.
339341
340342
Extension `result_claims` fold into tools/call parsing at `adopt()`;
341343
`notification_bindings` observe vendor notifications via bounded FIFOs.

0 commit comments

Comments
 (0)