docs: clarify when Client(raise_exceptions=True) actually raises - #3289
Draft
HaoChiBao wants to merge 2 commits into
Draft
docs: clarify when Client(raise_exceptions=True) actually raises#3289HaoChiBao wants to merge 2 commits into
HaoChiBao wants to merge 2 commits into
Conversation
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.
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Client(raise_exceptions=True): in-memory only; still raisesMCPErroron unexpected handler crashes, but unsanitises the message and chains__cause__; does not turn toolis_error=Trueinto an exception; ignored for URL/transport clients; drop onmode="legacy".Client.raise_exceptionsTODO with a docstring that matches that behaviour.docs_src/testing/tutorial002.pyplus 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 checkon touched Python files