modelcontextprotocol / modelcontextprotocol/python-sdk

Improve exception tracebacks for easier debugging

未關閉
#1,744 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

enhancement P2 v2
主要語言
Python
星號
24.3k
分支
4k
平均合併
1 天 1 小時
30 天內合併 PR
31

描述

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

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

該 issue 中未指定任何檔案或測試。先追蹤 asyncio/anyio 工作群組路徑以及 raise_exception 旗標的所有使用位置,然後檢視連結的例外處理相關 issue。完成的條件是:traceback 會揭示使用者層級的失敗、減少 wrapper 巢狀層級,並一致遵循 raise_exception。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
backend-api-design
Issue 類型
功能
難度
4/5
預估耗時
3-5 天
活躍度
活躍
描述清晰度
需要釐清
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。