fix(mcp): BUG-003 — replace invalid "type":"json" content blocks with "type":"text"#16
Merged
Merged
Conversation
… "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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
"type": "json"content blocks.jsonis not a valid MCP 2025-11-25 content type — spec only allowstext,image,audio,resource_link,resource. This caused Zod union validation failures in any spec-compliant MCP client (complete protocol failure via Cowork/Claude bridge).text_content(payload: Value) -> Valueprivate helper that serializes the JSON payload to a string and wraps it in{"type":"text","text":"..."}.handle_pipeline_status()tomcp_adapter— eliminated the last hand-rolled response envelope inledgerr-mcp-server.rs.content[0]["json"]access with aparse_response_payload()helper that deserializes from thetextfield.Test plan
cargo test -p ledgerr-mcp— 86 tests, 0 failures"type": "json"occurrences remain inmcp_adapter.rsdocs/bugs/SUMMARY.md🤖 Generated with Claude Code