Skip to content

fix: pass through unrecognized MCP content block types#650

Open
Bortlesboat wants to merge 1 commit intoanthropics:mainfrom
Bortlesboat:fix-search-result-content-blocks
Open

fix: pass through unrecognized MCP content block types#650
Bortlesboat wants to merge 1 commit intoanthropics:mainfrom
Bortlesboat:fix-search-result-content-blocks

Conversation

@Bortlesboat
Copy link
Contributor

Summary

  • MCP tool results with non-text/image content blocks (EmbeddedResource, ResourceLink, AudioContent) are silently dropped in _handle_sdk_mcp_request
  • Added an else branch that serializes unrecognized block types via model_dump(mode="json") instead of discarding them
  • Forward-compatible with any future MCP content types

Test plan

  • Added test with EmbeddedResource content block verifying it passes through
  • All existing tests pass (9/9 in test_sdk_mcp_integration.py)
  • Lint clean (ruff check + format)

Fixes #574

The content conversion loop in _handle_sdk_mcp_request only handled
text and image blocks. Other valid MCP content types (EmbeddedResource,
ResourceLink, AudioContent, and any future types) were silently dropped.

Add an else branch that uses model_dump() for Pydantic objects, passes
dicts through directly, and falls back to text coercion for anything
else.

Fixes anthropics#574
@Bortlesboat
Copy link
Contributor Author

Quick follow-up from my side: I’m treating review-required PRs as top priority this week. If you want any specific changes, rebase, or split, I can turn them around quickly.

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.

search_result content blocks silently dropped by MCP tool result handler

1 participant