modelcontextprotocol / modelcontextprotocol/python-sdk
docs: clarify when Client(raise_exceptions=True) actually raises
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 24.3k
- Fork
- 4k
- Merge trung bình
- 1 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 31
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với TODO raise_exceptions trong src/mcp/client/client.py và theo dõi hành vi hiện tại của các client in-memory và HTTP, bao gồm cả việc xử lý ExceptionGroup từ async with Client(...). So sánh điều này với hướng dẫn trong docs/troubleshooting.md, sau đó ghi lại các ngữ nghĩa đã được xác nhận trong docs/client/ và/hoặc docs/troubleshooting.md. Hoàn thành nghĩa là người dùng có thể xác định các lỗi bị ảnh hưởng và lựa chọn giữa các pattern được khuyến nghị với việc bắt MCPError bên trong context manager.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- documentation
- Loại issue
- Tài liệu
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 72/100