# JSON Schema 2020-12 and the Contract for Context | ​Ola Hungerford | MCP Release Party - Seattle

## Executive summary

This talk details the critical evolution of the Model Context Protocol (MCP), emphasizing that the schema acts as the 'contract for context' between tools and LLMs. The major update is the adoption of JSON Schema 2020-12 for tool definitions, replacing previous limited subsets. This upgrade significantly enhances expressiveness in both input and output schemas, allowing developers to use advanced keywords (like `allOf` and conditional constraints) and enabling better pre-LLM validation.

## Key takeaways

- Schema as Contract: In MCP, the schema defines the contract for context—how a tool specifies what data it accepts and returns. This is crucial for reliable LLM interaction.
- Adoption of JSON Schema 2020-12: MCP now conforms to JSON Schema 2020-12, aligning with the default dialect used by OpenAPI 3.1. This was achieved via SEP 2106 and expands support beyond previous limited subsets.
- Enhanced Input/Output Schemas: Input schemas gain full JSON Schema 2020-12 support, allowing for complex conditional keywords (e.g., `allOf`). Output schemas no longer face the same restrictive limitations as before.

## Technical details

- MCP Protocol Evolution: Previously, MCP used a limited subset of JSON Schema due to fragmentation and compatibility issues across various SDKs (e.g., fast-MCP). This required wrapping data in objects, which was awkward for simple types like arrays.
- JSON Schema 2020-12 Integration: The adoption of JSON Schema 2020-12 via SEP 2106 allows MCP to utilize advanced features like conditional keywords and references, making schema definition more expressive. Input schemas still require an object wrapper.
- Validation and Tool Design: Developers can perform validation *without* waiting for the LLM round trip. This ability to validate structured inputs pre-emptively improves efficiency by avoiding unnecessary token expenditure.
- Code Generation Compatibility: When using structured content (input/output schemas), an input schema can be converted into a callable signature, improving compatibility for code mode implementations within MCP.

## Practical implications

- Server authors must update their tool definitions to leverage the full capabilities of JSON Schema 2020-12.
- Client builders should utilize advanced schema keywords (like `allOf`) to define complex conditional logic for tools.
- Developers should prioritize using structured content and validation checks before relying on LLM inference to ensure robust, efficient API calls.

## Topics

AI, Build Engineering, Technical Specification, LLMs, JSON Schema 2020-12, SEP 2106, MCP Inspector

Source: https://www.youtube.com/watch?v=MGfCarfwsUk
