fix(server): align call_tool result shapes#2830
Conversation
|
I checked the remaining red matrix job. It is checks / test (3.13, lowest-direct, ubuntu-latest), failing in ests/issues/test_1363_race_condition_streamable_http.py::test_race_condition_invalid_accept_headers with RuntimeError: Task group is not initialized. Make sure to use run().\n\nThis PR only narrows MCPServer.call_tool result typing and updates the corresponding focused tests; the failure is in the streamable HTTP race-condition test path and the aggregate �ll-green job is passing. I am treating it as unrelated to this change unless maintainers see a connection I missed. |
7dc2001 to
468c9c0
Compare
|
Rebased this PR onto current Validated locally after the rebase: |
Summary
MCPServer._handle_call_toolMCPServer.call_toolwith the result shapes actually returned by the tool managerCallToolResultreturns and unstructured content-block returnsFixes #2695
To verify
uv run --frozen pytest tests\interaction\mcpserver\test_tools.py::test_tool_returning_call_tool_result_passes_through tests\interaction\mcpserver\test_tools.py::test_tool_without_output_schema_returns_unstructured_content tests\interaction\mcpserver\test_tools.py::test_call_tool_model_return_becomes_structured_content tests\server\mcpserver\test_server.py::TestServer::test_call_tool_return_annotation_lists_reachable_shapes -quv run --frozen pytest tests\interaction\test_coverage.py -quv run --frozen ruff check src\mcp\server\mcpserver\server.py tests\interaction\mcpserver\test_tools.py tests\interaction\_requirements.py tests\server\mcpserver\test_server.pyuv run --frozen pyright src\mcp\server\mcpserver\server.py tests\interaction\mcpserver\test_tools.py tests\interaction\_requirements.py tests\server\mcpserver\test_server.pygit diff --check