Skip to content

SEP-2106: Tools inputSchema & outputSchema Conform to JSON Schema 2020-12#2106

Open
olaservo wants to merge 20 commits intomodelcontextprotocol:mainfrom
olaservo:sep-834-json-schema-2020-12
Open

SEP-2106: Tools inputSchema & outputSchema Conform to JSON Schema 2020-12#2106
olaservo wants to merge 20 commits intomodelcontextprotocol:mainfrom
olaservo:sep-834-json-schema-2020-12

Conversation

@olaservo
Copy link
Member

@olaservo olaservo commented Jan 17, 2026

Summary

Note: This PR converts John McBride's original SEP proposal (PR #881) from issue #834 to the new SEP format established by SEP-1850. The original proposal and community discussion remain in PR #881—this PR formalizes it under the new process with a reference implementation.


  • inputSchema: Keep type: "object" required (since tool arguments are objects), but allow any additional JSON Schema properties to support composition keywords (anyOf, oneOf, allOf, etc.)
  • outputSchema: Fully support JSON Schema 2020-12 (arrays, primitives, objects, compositions)
  • structuredContent: Accept any JSON value validated by outputSchema
  • Include reference implementations: TypeScript SDK fork and demo server with example tools

Motivation

The current MCP specification restricts tool schemas in ways that conflict with full JSON Schema support and create real friction in the ecosystem.

The Problem: A weather API tool that returns hourly forecasts cannot return the natural response:

[
  { "hour": "09:00", "temp": 68, "conditions": "sunny" },
  { "hour": "10:00", "temp": 72, "conditions": "partly cloudy" }
]

Instead, developers must wrap arrays in unnecessary container objects—conflicting with common REST API patterns (GitHub Events API, AccuWeather, standard collection endpoints).

SDK Evidence: This isn't theoretical friction. FastMCP, one of the most popular Python SDKs, has implemented extensive workarounds with error messages that explicitly cite "MCP spec limitations." These workarounds have caused real bugs:

  • Issue #2455: $ref schemas without type: object broke ALL tools on a server
  • Issue #2421: Unexpected {"result": ...} wrapping confused users

Industry Precedent: OpenAPI went through this same evolution. OpenAPI 3.0's "extended subset" of JSON Schema caused years of tooling confusion. OpenAPI 3.1 made the strategic decision to fully align with JSON Schema 2020-12—MCP can learn from this rather than repeating the same journey.

Backward Compatible: All existing schemas continue to work. No migration required.

Related issue: #834
Original proposal: #881

Reference Implementation

Testing

Reference implementation tested with demo tools demonstrating:

  • get-weather-forecast: Raw array output (matches SEP motivation example)
  • get-count: Raw primitive output
  • find-by-id-or-name: Flexible input patterns using oneOf with type: "object"

AI disclosure

This PR was written with assistance from Claude. The SEP content, reference implementations, and rationale were developed collaboratively.

@olaservo olaservo added the SEP label Jan 17, 2026
@olaservo olaservo self-assigned this Jan 17, 2026
@olaservo olaservo added the draft SEP proposal with a sponsor. label Jan 17, 2026
@olaservo olaservo force-pushed the sep-834-json-schema-2020-12 branch from 876b01c to 0d23ecc Compare January 17, 2026 21:55
olaservo and others added 9 commits January 17, 2026 15:50
Add SEP proposing to loosen inputSchema, outputSchema, and
structuredContent restrictions to enable full JSON Schema 2020-12
compliance. This allows array responses and schema composition
keywords (anyOf, oneOf, allOf).

Relates to modelcontextprotocol#834

Co-Authored-By: John McBride <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
… support

- inputSchema: Allow any valid JSON Schema (enables oneOf/anyOf/allOf at root)
- outputSchema: Allow any valid JSON Schema (enables array schemas)
- structuredContent: Allow any JSON value (enables array responses)
- Update tools.mdx documentation
- Add example files demonstrating new capabilities

Reference: modelcontextprotocol#834

Co-Authored-By: John McBride <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Updated inputSchema spec to allow any valid JSON Schema (full 2020-12 compliance)
- Replaced get-array-content with get-weather-forecast tool
- Weather forecast matches the exact example from Motivation section
- Updated npm package references to latest versions:
  - SDK: @olaservo/[email protected]
  - Server: @olaservo/[email protected]

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Renamed 0000-json-schema-2020-12.md to 2106-json-schema-2020-12.md
- Updated SEP number to 2106
- Updated PR link to modelcontextprotocol#2106

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@olaservo olaservo force-pushed the sep-834-json-schema-2020-12 branch from 9eb42d9 to 7250539 Compare January 17, 2026 22:51
- Update title to match original: "Tools inputSchema & outputSchema Conform to JSON Schema 2020-12"
- inputSchema: Keep type: "object" required, but allow additional JSON Schema properties
- outputSchema: Fully flexible (any valid JSON Schema)
- structuredContent: Any JSON value (unknown)
- Update examples to show composition with type: "object"

Co-Authored-By: John McBride <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
@olaservo olaservo changed the title SEP: Full JSON Schema 2020-12 Support for Tool Schemas SEP-2106: Tools inputSchema & outputSchema Conform to JSON Schema 2020-12 Jan 17, 2026
olaservo and others added 3 commits January 17, 2026 16:09
Aligns schema.ts with John's original PR modelcontextprotocol#881:
- inputSchema: Keep type: "object" required, allow additional properties
- outputSchema: Any valid JSON Schema (with $schema field)
- Regenerate schema.json and schema.mdx

Co-Authored-By: John McBride <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
@sep-automation-bot
Copy link

Maintainer Activity Check

Hi @olaservo!

You're assigned to this SEP but there hasn't been any activity from you in 14 days.

Please provide an update on:

  • Current status of your review/work
  • Any blockers or concerns
  • Expected timeline for next steps

If you're no longer able to sponsor this SEP, please let us know so we can find another maintainer.


This is an automated message from the SEP lifecycle bot.

olaservo and others added 4 commits February 15, 2026 20:44
- Replace "SEP-834" references with "SEP-2106" throughout
- Update JSON-serialized content examples to model-friendly summaries
- Add cross-references to modelcontextprotocol#1906, TS SDK modelcontextprotocol#1149, and SEP-2200
- Create docs/community/seps/2106-json-schema-2020-12.mdx

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Run `npm run generate:seps` to update index, docs.json, and .mdx
to match the CI-expected output.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
"content": [
{
"type": "text",
"text": "Found 2 users: Alice ([email protected]) and Bob ([email protected])."
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note - example is deliberately aligned with this clarification of content vs structured content audience and format.

@sep-automation-bot
Copy link

Maintainer Activity Check

Hi @olaservo!

You're assigned to this SEP but there hasn't been any activity from you in 20 days.

Please provide an update on:

  • Current status of your review/work
  • Any blockers or concerns
  • Expected timeline for next steps

If you're no longer able to sponsor this SEP, please let us know so we can find another maintainer.


This is an automated message from the SEP lifecycle bot.

Resolve merge conflicts keeping the PR's open JSON Schema 2020-12
approach for inputSchema/outputSchema (index signatures instead of
explicit properties/required fields). Updated SEP index to reflect
25 Final SEPs + 1 Draft.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@olaservo olaservo requested a review from a team as a code owner March 9, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

draft SEP proposal with a sponsor. SEP

Projects

Status: Draft

Development

Successfully merging this pull request may close these issues.

3 participants