modelcontextprotocol / modelcontextprotocol/python-sdk

Improve exception tracebacks for easier debugging

Offen
#1,744 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

enhancement P2 v2
Vorherrschende Sprache
Python
Sterne
24.3k
Forks
4k
Ø Merge
1 T. 1 Std.
Gemergte PRs (30 T.)
31

Beschreibung

Summary

Make exception tracebacks clearer and easier to understand by reducing asyncio/anyio wrapper noise.

Problem

  • Exceptions are often wrapped in multiple layers of asyncio/anyio task group machinery
  • Tracebacks are hard to read and don't clearly point to the root cause
  • The raise_exception flag is not consistently respected
  • Errors from deep inside task groups obscure the actual failure point

Goal

  • Cleaner tracebacks that point to user code, not SDK internals
  • Raise exceptions from the main context where possible
  • Reduce nesting of exception wrappers

Related

  • #743 - RuntimeError but the actual root cause is not logged correctly
  • #396 - MCP Server: Inconsistent Exception Handling in @app.call_tool
  • #1401 - ClientSession Error Handling
  • #1742 - Introduce typed error classes with metadata

AI Disclaimer

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Im Issue sind keine Dateien oder Tests angegeben. Beginne damit, die asyncio/anyio-Pfade der Task-Gruppen und jede Verwendung des Flags raise_exception nachzuverfolgen, und prüfe anschließend die verknüpften Issues zur Ausnahmebehandlung. Als erledigt gilt die Aufgabe, wenn Tracebacks den Fehler auf Benutzerebene offenlegen, die Verschachtelung von Wrappern reduziert ist und raise_exception konsistent berücksichtigt wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
backend-api-design
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Aktiv
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.