[BUG] MCP: structuredContent overrides content field, losing actual tool response
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When an MCP server returns a response containing both a content array (with actual tool output) and a structuredContent field (with only metadata), Claude Code reads only structuredContent and discards the content field entirely. The model never receives the actual tool output.
For example, the MCP server returns:
{
"content": [{"type": "text", "text": "<actual 29,335 characters of response>"}],
"structuredContent": {"result": "Content length: 29335"},
"isError": false
}
But the model only receives:
{"result": "Content length: 29335"}
The actual content is silently lost. The same MCP server works correctly with Amazon Q, which reads from the content field.
What Should Happen?
Claude Code should fall back to the content field when structuredContent contains only metadata (like a content length summary) rather than actual tool output.
Error Messages/Logs
Tool call: mcp__coding-mcp__get_coding_standards
Tool result received by model: {"result":"Content length: 29335"}
Actual MCP server response (verified via Amazon Q):
{
"content": [{"type": "text", "text": "<full coding standards text - 29335 chars>"}],
"structuredContent": {"result": "Content length: 29335"},
"isError": false
}
Steps to Reproduce
- Configure a remote MCP server (SSE transport) that returns both
contentandstructuredContentin tool responses - The
contentfield contains the actual text output - The
structuredContentfield contains metadata only (e.g.,{"result": "Content length: 29335"}) - Call any tool on that MCP server from Claude Code
- Observe: the model only receives
structuredContent, the full text fromcontentis never passed through
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.142
Platform
AWS Bedrock
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
- MCP server uses SSE transport (remote)
- All tools on the server exhibit the same behavior:
init_context(23050 chars),get_coding_standards(29335 chars),search_knowledge(8767 chars),load_code_generation_context(1225 chars),load_verb_functions_context(10851 chars),load_testing_context(3060 chars) - The varying content lengths prove the server is generating real content — it's just never reaching the model
- No client-side setting exists to control field preference (confirmed via Claude Code docs)
- The bug is in Claude Code's MCP response handler — it unconditionally prefers
structuredContentwith no fallback tocontent
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗