modelcontextprotocol / modelcontextprotocol/python-sdk
docs: clarify when Client(raise_exceptions=True) actually raises
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 24.3k
- Forks
- 4k
- Ø Merge
- 1 T. 1 Std.
- Gemergte PRs (30 T.)
- 31
Beschreibung
Description
Client exposes raise_exceptions: bool = False with a code TODO asking when raise_exceptions=True actually raises:
https://github.com/modelcontextprotocol/python-sdk/blob/main/src/mcp/client/client.py (around the raise_exceptions field)
What's missing
There is no clear user-facing documentation of:
- Which failure modes are affected (in-process server exceptions vs transport/protocol errors)
- How this interacts with
ExceptionGroupwrapping fromasync with Client(...) - Recommended patterns vs catching
MCPErrorinside the context manager (asdocs/troubleshooting.mdalready teaches)
Proposed work
- Trace current behavior on
mainfor in-memory and HTTP clients - Document the real semantics in
docs/client/and/ordocs/troubleshooting.md - Add a small docs_src example and/or regression test if behavior is surprising
- Only change runtime behavior if docs reveal a clear bug; prefer docs-first
Related
- TODO(Marcelo) on
Client.raise_exceptionsinsrc/mcp/client/client.py - #1401 ClientSession Error Handling (different surface; has an open PR)
- troubleshooting ExceptionGroup guidance
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit dem raise_exceptions TODO in src/mcp/client/client.py und verfolge das aktuelle Verhalten für In-Memory- und HTTP-Clients, einschließlich der ExceptionGroup-Behandlung bei async with Client(...). Vergleiche dies mit den Hinweisen in docs/troubleshooting.md und dokumentiere die bestätigte Semantik in docs/client/ und/oder docs/troubleshooting.md. Als erledigt gilt die Aufgabe, wenn Benutzer betroffene Fehler identifizieren und zwischen den empfohlenen Mustern und dem Abfangen von MCPError innerhalb des Context-Managers wählen können.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- documentation
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 72/100