FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

docs: clarify when Client(raise_exceptions=True) actually raises by HaoChiBao · Pull Request #3289 · modelcontextprotocol/python-sdk · GitHub

docs: clarify when Client(raise_exceptions=True) actually raises - #3289

Draft
HaoChiBao wants to merge 2 commits into
modelcontextprotocol:mainfrom
HaoChiBao:docs/3287-raise-exceptions-semantics
Draft

docs: clarify when Client(raise_exceptions=True) actually raises#3289
HaoChiBao wants to merge 2 commits into
modelcontextprotocol:mainfrom
HaoChiBao:docs/3287-raise-exceptions-semantics

Conversation

HaoChiBao commented Aug 11, 2026
edited
Loading

Copy link
Copy Markdown

Summary

  • Document the real semantics of Client(raise_exceptions=True): in-memory only; still raises MCPError on unexpected handler crashes, but unsanitises the message and chains __cause__; does not turn tool is_error=True into an exception; ignored for URL/transport clients; drop on mode="legacy".
  • Expand Testing, with cross-links from Clients, Troubleshooting, and the low-level server page; replace the Client.raise_exceptions TODO with a docstring that matches that behaviour.
  • Add docs_src/testing/tutorial002.py plus docs_src tests covering the True/False contrast.

Fixes #3287.

AI disclosure

This contribution was prepared with AI assistance (Cursor). A human reviewed the traced behaviour and the docs/tests before opening the PR.

Test plan

  • uv run --frozen ruff format / ruff check on touched Python files
  • Relevant docs_src and client raise_exceptions tests (7 passed)
  • Confirm docs render for Testing / Troubleshooting / Clients "In tests"
  • No runtime behaviour change intended

Document that the flag only unsanitises unexpected in-memory handler
crashes (still MCPError, with message/__cause__), leaves tool is_error
results alone, and is ignored for URL/transport clients. Fixes modelcontextprotocol#3287.
HaoChiBao changed the title test docs: clarify when Client(raise_exceptions=True) actually raises Aug 11, 2026
HaoChiBao closed this Aug 11, 2026
HaoChiBao reopened this Aug 11, 2026
Keep the full semantics on the Testing page and the low-level-server
cross-link; the troubleshooting tip restated the same material.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: clarify when Client(raise_exceptions=True) actually raises

1 participant


Back | FazBrowse Home | New Git URL