modelcontextprotocol / modelcontextprotocol/python-sdk
tests/client/test_client.py: 14 failures on Windows — AttributeError: '...Result' object has no attribute '_meta'
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ả
Initial Checks
- I confirm that I'm using the newest release of my line (the latest 2.x, or the latest 1.x if I'm still on v1)
- I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue
Release line
2.x (current stable)
Description
On a clean checkout of main, tests/client/test_client.py fails with 14 errors of the form AttributeError: 'CallToolResult' object has no attribute '_meta'. Did you mean: 'meta'?
The snapshots pass the wire name (snapshot(CallToolResult(_meta={...}))), but inline_snapshot's generic_call_adapter.argument() does a plain getattr(value, '_meta') and the pydantic model exposes the field as meta. The data is there — the repr shows meta={'io.modelcontextprotocol/serverInfo': ...}.
I'd expect the test suite to pass on a fresh clone with locked dependencies.
Ruled out: unlocked dependency resolution (reproduced with --frozen and --no-sync), Python version (3.12.14 and 3.14.2 both fail), and a non-ASCII checkout path (reproduces under a plain ASCII path too).
I only have Windows to test on, so I don't know whether this reproduces on Linux or macOS. If CI is green, the difference is presumably platform-specific and I'm happy to run whatever would help narrow it down.
┃ File ┃ Function ┃ Function Line ┃ Error Line ┃ Error ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩
│ tests\client\test_client.py │ test_client_with_simple_server │ 133 │ │ │
│ tests\client\test_client.py │ test_client_list_tools │ 151 │ │ │
│ tests\client\test_client.py │ test_client_call_tool │ 179 │ │ │
│ tests\client\test_client.py │ test_read_resource │ 191 │ │ │
│ tests\client\test_client.py │ test_get_prompt │ 272 │ │ │
│ tests\client\test_client.py │ test_client_list_resources_wi… │ 339 │ │ │
│ tests\client\test_client.py │ test_client_list_resource_tem… │ 358 │ │ │
│ tests\client\test_client.py │ test_list_prompts │ 369 │ │ │
│ tests\client\test_client.py │ test_complete_with_prompt_ref… │ 387 │ │ │
│ tests\client\test_client.py │ test_call_tool_auto_loop_disp… │ 768 │ 797 │ AttributeError │
│ tests\client\test_client.py │ test_call_tool_auto_loop_disp… │ 810 │ 846 │ AttributeError │
│ tests\client\test_client.py │ test_call_tool_auto_loop_disp… │ 857 │ 881 │ AttributeError │
│ tests\client\test_client.py │ test_get_prompt_auto_loop_res… │ 945 │ 968 │ AttributeError │
│ tests\client\test_client.py │ test_read_resource_auto_loop_… │ 976 │ 999 │ AttributeError
Example Code
┃ File ┃ Function ┃ Function Line ┃ Error Line ┃ Error ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩
│ tests\client\test_client.py │ test_client_with_simple_server │ 133 │ │ │
│ tests\client\test_client.py │ test_client_list_tools │ 151 │ │ │
│ tests\client\test_client.py │ test_client_call_tool │ 179 │ │ │
│ tests\client\test_client.py │ test_read_resource │ 191 │ │ │
│ tests\client\test_client.py │ test_get_prompt │ 272 │ │ │
│ tests\client\test_client.py │ test_client_list_resources_wi… │ 339 │ │ │
│ tests\client\test_client.py │ test_client_list_resource_tem… │ 358 │ │ │
│ tests\client\test_client.py │ test_list_prompts │ 369 │ │ │
│ tests\client\test_client.py │ test_complete_with_prompt_ref… │ 387 │ │ │
│ tests\client\test_client.py │ test_call_tool_auto_loop_disp… │ 768 │ 797 │ AttributeError │
│ tests\client\test_client.py │ test_call_tool_auto_loop_disp… │ 810 │ 846 │ AttributeError │
│ tests\client\test_client.py │ test_call_tool_auto_loop_disp… │ 857 │ 881 │ AttributeError │
│ tests\client\test_client.py │ test_get_prompt_auto_loop_res… │ 945 │ 968 │ AttributeError │
│ tests\client\test_client.py │ test_read_resource_auto_loop_… │ 976 │ 999 │ AttributeError
git clone https://github.com/modelcontextprotocol/python-sdk.git
cd python-sdk
uv sync --frozen --all-extras --dev
uv run --no-sync pytest tests/client/test_client.py -q
# → 14 failed, 33 passed
Python & MCP Python SDK
Python 3.12.14 (also reproduced on 3.14.2)
mcp 2.2.1.dev1+6affe5c0 (source checkout of main, commit 6affe5c0)
inline_snapshot 0.28.0, pydantic 2.12.5 (both from uv.lock)
uv 0.12.16
Windows 11, PowerShell
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 bằng cách chạy uv run --no-sync pytest tests/client/test_client.py -q trên Windows với các dependency đã được khóa. Đọc các trường hợp bị lỗi trong tests/client/test_client.py và so sánh các đối số snapshot của CallToolResult với hành vi meta/_meta được báo cáo. Được xem là hoàn tất khi 14 lỗi đã được giải quyết và tệp kiểm thử client chạy đạt mà không làm yếu các kết quả mong đợi.
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
- testing
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 75/100