What is MCP structured content? JSON tool results

By

MCP structured content returns machine-readable JSON from a tool. Learn how structuredContent, outputSchema, and text blocks fit together in real calls.

MCP structured content is JSON returned by a tool in the structuredContent field. It lets client code read the result directly, and can be checked against the tool’s outputSchema.

Build an MCP server shows this in a working search tool. That tutorial keeps the server implementation and validation tests.

How structured content works

A tool result can contain both content blocks and structured data. Text blocks give clients a readable representation. Structured content gives them JSON values they can inspect without extracting fields from prose.

The MCP tools specification recommends also returning serialized JSON in a text block for compatibility. When the tool declares an output schema, the server must return structured data matching it. Clients should validate that data.

FieldJobExample from the server tutorial
inputSchemaDescribes accepted argumentsSearch query and result limit
outputSchemaDescribes structured result shapeTotal count and results array
structuredContentHolds the returned JSONSearch results object
contentHolds text or other content blocksThe same object serialized as text
One MCP tool result in two formsThe search handler creates a result object. It returns that object as structuredContent and serializes it into a text content block for compatibility.Search handlerResult objectstructuredContentJSON text blockClient reads fieldsClient reads text

In coding tools

The checked connection guides for Claude Code, Codex, Cursor, and Grok Build document MCP tool use. They do not specify a common interface for choosing between content and structuredContent, or promise identical output-schema validation.

Check the returned message in your client. The server tutorial shows real calls through the Inspector, and the filesystem walkthrough records both fields on the wire.

Details checked against each vendor’s documentation in November 2026.

A real example

The server tutorial’s search_posts handler builds an output object, then returns it in both forms:

return {
  content: [{ type: 'text', text: JSON.stringify(output) }],
  structuredContent: output
}

Its tested search for zzqqxx returned {"total":0,"results":[]}. Client code can read total and results directly, including when no posts match.

When to use it

Return structured content when another program needs specific fields from a tool result. A search interface can display the returned titles and URLs without parsing an explanation written for a person.

Pitfalls

MCP tool errors still need checking. Valid JSON can report an empty result, and a failed operation needs its own error handling.

A schema checks shape, types, and declared constraints. Your handler still needs to enforce access rules and return correct data. The server tutorial filters unpublished posts before its tools can search them.

Structured outputs describes schema-constrained model generation. Here the server produces the JSON as the result of running a tool.

For an app that exposes data to coding agents, see CLI Tools Cabinet’s discovery tutorial.

  • Structured outputs: Structured outputs are answers that follow a JSON Schema you send with the request. How that differs from JSON mode in Claude Code, Codex, Cursor and Grok.
  • MCP tool errors: MCP tool errors report failures inside a tool result. Learn how isError differs from a protocol error, with real validation and empty-search examples.
  • JSON-RPC: JSON-RPC carries requests and responses between MCP clients and servers. Learn to read message IDs, methods, results, and errors in a real coding-agent trace.

All AI glossary entries → · AI for coding hub →

Want me to talk about your product? You can sponsor this site.