CClaude Code Catalog
All Skills

MCP Structured Output Validator

CodingIntermediate

Generates outputSchema definitions for MCP tools so responses include validated structuredContent alongside human-readable content.

Trigger/mcp-output-schema
Frequencyper tool

MCP Server Author? Use /mcp-output-schema to add type-safe outputs to your tools

Integration Developer? Ensure downstream systems can parse tool results reliably

MCPStructured OutputJSON SchemaValidation

How It Works

/mcp-output-schema [tool-name] run
Phase 1: analyze tool output
output-analysis
Infer schema from current tool responses
schema-gen
Generate outputSchema definition
validator
Create runtime validation layer
Wire schema into tool definition
Tool with outputSchema + structuredContent validation

Skill Code

# MCP Structured Output Validator ## Trigger: /mcp-output-schema [tool-name] When invoked: 1. Define outputSchema on tool registration: ```typescript server.tool( "get-weather", { description: "Get current weather for a city", inputSchema: { type: "object", properties: { city: { type: "string" } }, required: ["city"] }, // NEW: declare structured output schema outputSchema: { type: "object", properties: { temperature: { type: "number" }, unit: { type: "string", enum: ["celsius", "fahrenheit"] }, condition: { type: "string" }, humidity: { type: "number" } }, required: ["temperature", "unit", "condition"] } }, async ({ city }) => { const data = await fetchWeather(city); return { // Human-readable content (always present) content: [{ type: "text", text: `It's ${data.temp}°C and ${data.condition} in ${city}` }], // Machine-readable structured output (validated against outputSchema) structuredContent: { temperature: data.temp, unit: "celsius", condition: data.condition, humidity: data.humidity } }; } ); ``` 2. Validation behavior: - Server SDK auto-validates structuredContent against outputSchema - Schema violations throw at runtime (fail-fast) - structuredContent MUST be present when outputSchema is defined - content[] is still required for human-readable fallback 3. Client consumption: ```typescript const result = await client.callTool("get-weather", { city: "Seoul" }); // Type-safe access to structured data const temp = result.structuredContent.temperature; // number const condition = result.structuredContent.condition; // string ```

Copy and paste into your CLAUDE.md to start using immediately.

How MCP Structured Output Validator Works

MCP Structured Output Validator analyzes existing tool response patterns to infer and generate an outputSchema, then adds a runtime validation layer ensuring structuredContent conforms to the declared schema. Guarantees dual output — human-readable content[] alongside machine-readable structuredContent.

When to Use MCP Structured Output Validator

Most powerful when downstream systems need to programmatically consume MCP tool results reliably, or when you need type-safe guarantees on tool response shapes.

Key Strengths

  • Auto-infers and generates outputSchema definitions
  • Runtime schema validation with fail-fast behavior
  • Dual human-readable and machine-readable output
  • Ensures downstream integration stability

Same Category

Coding View All

Popular in Other Categories