Remove unused StreamableHTTPTransport.get_session_id()

Merged
MA
3mo ago
+1-9

Removes the dead StreamableHTTPTransport.get_session_id() method from the client streamable HTTP transport, along with the two stale TODO(Marcelo) comments about it.

Motivation and Context

The method existed to back the get_session_id callback that v1's streamable_http_client yielded as the third tuple element. That callback was already removed on main (documented in docs/migration.md), which left the getter with no callers in src/, tests/, or examples/ (it was # pragma: no cover) and no way to reach a transport instance through the public entry point anyway — streamable_http_client yields only the two streams.

The session_id attribute the getter wrapped is unchanged; it's the transport's own working state (header stamping, GET/DELETE gating, terminate-on-close).

How Has This Been Tested?

Existing client streamable HTTP tests pass. Also drove streamable_http_client end-to-end against a real MCPServer streamable HTTP app on a local port (initialize → tool call → DELETE on close) to confirm the client path is unaffected.

Breaking Changes

StreamableHTTPTransport.get_session_id() no longer exists. This was public in v1, so the removal is added to the existing "get_session_id callback removed from streamable_http_client" section of docs/migration.md, which already points users at httpx2 event hooks for capturing the session ID.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

No pragmas or type-ignores added; the removal drops one # pragma: no cover.