Skip to content

fix(mcp): BUG-003 — replace invalid "type":"json" content blocks with "type":"text"#16

Merged
elasticdotventures merged 1 commit into
mainfrom
fix/bug-003-content-type-json
Apr 16, 2026
Merged

fix(mcp): BUG-003 — replace invalid "type":"json" content blocks with "type":"text"#16
elasticdotventures merged 1 commit into
mainfrom
fix/bug-003-content-type-json

Conversation

@promptexecutionerr
Copy link
Copy Markdown
Collaborator

Summary

  • P0 bug: all 27 tool handlers returned "type": "json" content blocks. json is not a valid MCP 2025-11-25 content type — spec only allows text, image, audio, resource_link, resource. This caused Zod union validation failures in any spec-compliant MCP client (complete protocol failure via Cowork/Claude bridge).
  • Added text_content(payload: Value) -> Value private helper that serializes the JSON payload to a string and wraps it in {"type":"text","text":"..."}.
  • Replaced all 27 occurrences via the helper.
  • Added handle_pipeline_status() to mcp_adapter — eliminated the last hand-rolled response envelope in ledgerr-mcp-server.rs.
  • Updated all 8 affected test files: replaced content[0]["json"] access with a parse_response_payload() helper that deserializes from the text field.

Test plan

  • cargo test -p ledgerr-mcp — 86 tests, 0 failures
  • Zero "type": "json" occurrences remain in mcp_adapter.rs
  • BUG-003 marked resolved in docs/bugs/SUMMARY.md
  • CHANGELOG updated with v1.3.8 entry

🤖 Generated with Claude Code

… "type":"text"

MCP 2025-11-25 spec only allows text/image/audio/resource_link/resource
as content types. All 27 tool handlers were returning "type":"json" which
causes Zod union validation failures in spec-compliant clients (complete
protocol failure from any real MCP bridge).

Changes:
- Add text_content() private helper: serializes Value payload to a JSON
  string and wraps it in a {"type":"text","text":...} content block
- Replace all 27 "type":"json" content blocks via text_content()
- Add handle_pipeline_status() handler in mcp_adapter — eliminates the
  last hand-rolled response envelope in ledgerr-mcp-server.rs
- Update all test files: replace ["json"] content access with
  parse_response_payload() helper that deserializes the text field
- Mark BUG-003 resolved in docs/bugs/SUMMARY.md
- Add v1.3.8 entry to CHANGELOG.md

All 86 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@elasticdotventures elasticdotventures merged commit 4ce1b1c into main Apr 16, 2026
3 checks passed
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.

2 participants