Urgent.News

What's breaking now, across thousands of outlets.

AI

MCP structuredContent: Claude Code Drops Your Text Blocks

If you build an MCP server, the instructions you write into the text of a tool result may never reach the model. MCP (Model Context Protocol) lets an AI app such as Claude Code call tools on a server you run. A tool result can carry plain text and a JSON object called structuredContent , and the app decides which of the two the model reads. This post shows how to check what the app actually hands…

This report details how Claude Code, Anthropic's coding assistant, interacts with the Model Context Protocol (MCP) when requesting tool results. MCP allows an AI application like Claude Code to call tools on a server while hiding certain result details from the model. The report examines how Claude Code handles structuredContent and text blocks in tool responses.

The specifications state that tools returning structured content should also provide the serialized JSON in a TextContent block for backwards compatibility. However, the server's text and JSON were not equivalent, with the text containing framing information not present in the JSON. Claude Code treated the JSON as the result and dropped the accompanying text.

Three methods were used to confirm this behavior: examining Claude Code's minified client code, reviewing the raw claude-p stream from an evaluation run, and checking the deployed server through a production connection. All three sources indicated that Claude Code received and used only the JSON data, discarding the text.

When analyzing the observed tool results, it was found that Claude Code dropped not only the framing text but also messages with IDs, authors, timestamps, and URLs. However, data such as citations and injection cases still reached the model. The issue persisted despite the eval showing the successful delivery of the model's requested tool result.

Further investigation revealed that the issue arose from Claude Code's handling of the text block. The code filtered out any text blocks of type "text" and replaced them with the JSON content. This behavior, while not explicitly documented, was observed in Claude Code's implementation.

To address the issue, a note field was added to the structuredContent, which stripped out unwanted lines from the text block. This ensured that important data, such as citations and message details, still reached the model. The modified reply() function kept the text block for hosts that read it and wrote the same framing information into structuredContent, allowing for seamless handling of both text and structuredContent.

In summary, Claude Code's treatment of structuredContent and text blocks in tool results can lead to important data being hidden from the model. By understanding this behavior and implementing a note field to filter out unwanted text lines, developers can ensure that all necessary information is passed to the model, improving the accuracy and effectiveness of tool interactions.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in AI

PixelLeak: AI coding agents leaked 13,000+ internal screenshots to public GitHub repos

Security firm Glow disclosed on September 29, 2026 that it had found more than 13,000 internal screenshots and recordings, from developers at 300+ organizations, sitting in public GitHub repositories…

  • Over 13,000 internal screenshots leaked to public GitHub repos in September 2026
  • Coding agents created screenshots via gitshot workaround, storing in personal accounts
  • Issue arose from GitHub CLI lacking --attach flag for image uploads

The China Shock in the AI Era

The dominance of Chinese manufacturing and the rise of AI could create new economic imbalances and strains on a massive scale warns Yasheng Huang.

  • 70% of voters support AI restrictions in 10 US states
  • 52% of Americans more concerned than excited about AI
  • "China Shock" and "AI Productivity Shock" may create economic imbalance

More from Saturday 14 November →