Skip to content

fix: tighten MCPServer tool result typing#2881

Open
sarvesh1327 wants to merge 1 commit into
modelcontextprotocol:mainfrom
sarvesh1327:fix/mcpserver-call-tool-result-type
Open

fix: tighten MCPServer tool result typing#2881
sarvesh1327 wants to merge 1 commit into
modelcontextprotocol:mainfrom
sarvesh1327:fix/mcpserver-call-tool-result-type

Conversation

@sarvesh1327

Copy link
Copy Markdown

Summary

  • Remove the unreachable raw-dict branch in MCPServer._handle_call_tool
  • Update MCPServer.call_tool to describe the actual converted result shapes
  • Add coverage for unstructured dict conversion staying as text content

Fixes #2695.

Test Plan

  • uv run --frozen pytest tests/server/mcpserver/test_func_metadata.py -q
  • uv run --frozen ruff check src/mcp/server/mcpserver/server.py tests/server/mcpserver/test_func_metadata.py
  • uv run --frozen pyright src/mcp/server/mcpserver/server.py tests/server/mcpserver/test_func_metadata.py

Notes

  • Scope intentionally small.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dead code path in MCPServer._handle_call_tool and incorrect call_tool return type

1 participant