User GuidesStructured Content (Output Schemas)

Structured Content (Output Schemas)

Define a tool’s structured output with a no-code schema builder, author mock payloads that conform to it, and return spec-compliant structuredContent on tools/call — all without writing JSON by hand.

Overview

The MCP 2025-06-18 spec lets a tool declare an optional outputSchema (JSON Schema) and return a structuredContent object alongside the classic text content. A²D supports this end to end:

  • Declare a tool’s outputSchema with the same visual builder used for inputSchema.
  • Author a mock structuredContent payload with a guided form shaped by that schema.
  • The runtime advertises outputSchema on tools/list and returns structuredContent (plus a backward-compatible serialized text block) on tools/call.
  • Publishing to Exchange carries the outputSchema and structured mocks when present.

Structured content is entirely optional. Tools without an output schema behave exactly as before — nothing changes for existing servers.


Define an output schema

  1. Open a server and go to the Tools tab.
  2. Click Add Tool (or edit an existing tool).
  3. Below the Input Schema builder you’ll find Output Schema Properties. Add properties just like you do for inputs — with nested objects, arrays, enums, and the null type for nullable fields.
  4. Save the tool.

The root of the output schema is always type: object (structured content is a JSON object per the spec). Leave the output schema empty if the tool does not return structured data — it will be omitted entirely.

The output schema builder supports the same types as the input builder — string (with enum), number, integer, boolean, object, array, and now null.


Author a structured mock

Once a tool has an output schema, its mock scenarios gain a Return structured content toggle.

  1. In the tool’s Mock Data Responses, expand a scenario.
  2. Turn on Return structured content.
  3. A guided form appears with one input per property in your output schema — text boxes, number fields, switches for booleans, dropdowns for enums, and Add item buttons for arrays.
  4. Fill in the values. A live validation panel flags anything that doesn’t match the schema (for example a missing required field).

The authored payload is stored on the scenario and emitted as structuredContent. A JSON-stringified copy is kept in the classic text response block for backward compatibility.

If you change the output schema after authoring mocks, existing structured payloads may no longer conform. The builder shows an inline validation warning, and the runtime returns an error result until the payload is fixed.


What the runtime returns

For a tool with an output schema, tools/call returns a spec-compliant result:

{
  "content": [
    { "type": "text", "text": "{\"temperature\":22.5,\"conditions\":\"Partly cloudy\"}" }
  ],
  "structuredContent": { "temperature": 22.5, "conditions": "Partly cloudy" }
}
  • content[0].text is the JSON-stringified payload — clients that don’t understand structured content still get a usable response.
  • structuredContent is the object itself, validated against the tool’s outputSchema.

If a scenario is a plain JSON response (no structured toggle) but the tool declares an output schema, the JSON is validated and surfaced as structuredContent automatically. If the payload does not conform, the call returns an isError result describing the mismatch.


Test it with the Protocol Tester

  1. Open the server’s Test tab (or the standalone Protocol Tester).
  2. Run tools/list — tools with an output schema show it in the tool details.
  3. Call a tool — the response pane shows both the structuredContent object and the text block.

You can also verify from the command line:

curl -X POST https://ma2d.vercel.app/api/platform/YOUR_SERVER_ID/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

Publishing

When you publish a server to Anypoint Exchange, the generated spec carries each tool’s outputSchema only when it is set, and includes structured mock scenarios under a namespaced x-a2d-mock-scenarios key. Tools that never adopted structured content keep their original, minimal shape — no empty or placeholder fields are added.

Publishing to Exchange →


Next Steps


Structured content makes your mocked tools return typed, validated objects — exactly like a production MCP server.