Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
5015b6f
Add first pass at JSON schema version clarification
olaservo Jun 5, 2025
de40ca5
Add updated schemas
olaservo Jun 5, 2025
8aaede2
Merge branch 'main' into clarify-json-schema-version
olaservo Jun 5, 2025
29dc3d6
Update docs/specification/draft/basic/index.mdx
olaservo Jun 5, 2025
220eb46
Fix formatting
olaservo Jun 5, 2025
2747ccf
Use boolean set to true to indicate that a tool has no parameters
olaservo Jun 5, 2025
d2e2f1d
Merge branch 'main' into clarify-json-schema-version
olaservo Jun 5, 2025
3332e6e
Merge branch 'main' into clarify-json-schema-version
olaservo Jun 13, 2025
747d70b
Address eiriktsarpalis feedback: Make schema guidance for tools with …
olaservo Jun 13, 2025
609cac1
Fix formatting
olaservo Jun 13, 2025
b3593b0
Fix warning indent
olaservo Jun 13, 2025
46bb011
Merge branch 'main' into clarify-json-schema-version
olaservo Jun 29, 2025
a9b949c
Change default JSON Schema dialect to 2020-12 based on feedback
olaservo Jun 29, 2025
d18b90e
Merge branch 'main' into clarify-json-schema-version
olaservo Jul 8, 2025
abee932
Merge branch 'main' into clarify-json-schema-version
olaservo Aug 12, 2025
3396719
Merge remote-tracking branch 'upstream' into clarify-json-schema-version
olaservo Oct 6, 2025
9c81b3d
Fix formatting
olaservo Oct 6, 2025
278c1fd
Regenerate draft schema doc
olaservo Oct 6, 2025
97a2b21
Make more consistent with newer PR
olaservo Oct 7, 2025
e045a57
Update typescript schemas to 2020-12
olaservo Oct 7, 2025
e2cf924
Removed the potentially confusing { "additionalProperties": true } op…
olaservo Oct 7, 2025
ae487bc
Make example more realistic
olaservo Oct 7, 2025
42b4202
Remove potentially confusing bullet
olaservo Oct 7, 2025
8a30474
Restore meta schemas and remove sed hack
olaservo Oct 8, 2025
19ec849
Apply suggestion from @dsp-ant
olaservo Oct 8, 2025
0e22cd4
Apply suggestion from @dsp-ant
olaservo Oct 8, 2025
3996fd3
Merge branch 'clarify-json-schema-version' of https://github.com/olas…
olaservo Oct 8, 2025
de4c3b3
Merge branch 'main' of https://github.com/modelcontextprotocol/modelc…
olaservo Oct 14, 2025
8142c0b
(docs): Update Tool interface outputSchema documentation to clarify d…
olaservo Oct 14, 2025
c4d9979
(docs): Update outputSchema description to clarify defaults and restr…
olaservo Oct 14, 2025
c686ec2
Update schema.mdx
olaservo Oct 14, 2025
098bbf2
Merge branch 'main' of https://github.com/modelcontextprotocol/modelc…
olaservo Oct 18, 2025
be37ecc
Add 2020-12 metaschema generation and validation
olaservo Oct 26, 2025
3549d6f
Remove schema wonkyness
olaservo Oct 26, 2025
7ed8fb3
Fix TypeScript compilation by adding explicit include pattern
olaservo Oct 29, 2025
27626dd
Merge upstream main into clarify-json-schema-version
olaservo Nov 9, 2025
ebe0126
refactor: remove deprecated JSON Schema generator and add new Zod-bas…
olaservo Nov 10, 2025
12d8601
Simplify scripts
olaservo Nov 10, 2025
ef16677
Merge branch 'main' into clarify-json-schema-version
localden Nov 11, 2025
10cfd6b
Merge branch 'clarify-json-schema-version' of https://github.com/olas…
olaservo Nov 12, 2025
9490dd9
Remove fix-result-extends.js
olaservo Nov 12, 2025
c523428
Move tool input schema requirements for null to Tools section
olaservo Nov 12, 2025
04f2ae0
Remove invalid true value for tools with no params
olaservo Nov 12, 2025
0813d3c
Merge branch 'main' of https://github.com/modelcontextprotocol/modelc…
olaservo Nov 12, 2025
d7c9587
Restore 2020-12 changes
olaservo Nov 12, 2025
cb573d5
Update tool definition to replace 'search_products' with 'calculate_s…
olaservo Nov 12, 2025
909738c
Fix formatting
olaservo Nov 12, 2025
9febb60
Fix merge
olaservo Nov 12, 2025
8461581
Test with patched version
olaservo Nov 12, 2025
a938672
Regenerate schema
olaservo Nov 12, 2025
f613dcf
Remove extra validation added for custom scripts
olaservo Nov 12, 2025
e16aa3b
Update TypeDoc configuration to maintain exclusion of zodded.ts
olaservo Nov 12, 2025
b6a1c24
Add exclusion for zodded.ts in TypeScript configuration
olaservo Nov 12, 2025
42f47a4
Regenerate schema.mdx for draft
olaservo Nov 12, 2025
671c6b8
Restore alphabetical sorting for defs
olaservo Nov 12, 2025
ad2664f
Restore indent and description ordering
olaservo Nov 12, 2025
cbbfc6a
Merge branch 'main' of https://github.com/modelcontextprotocol/modelc…
olaservo Nov 12, 2025
fdd681b
Update schema mdx
olaservo Nov 12, 2025
b97ed92
Re-condense json check script
olaservo Nov 12, 2025
98431c6
Regenerate schema.mdx
olaservo Nov 12, 2025
343b9d7
Update docs/specification/draft/server/tools.mdx
olaservo Nov 12, 2025
b0a9563
Merge branch 'main' into clarify-json-schema-version
olaservo Nov 12, 2025
5ecd51d
Test ts-to-zod update in ci
olaservo Nov 14, 2025
0c9f98e
Merge branch 'main' of https://github.com/modelcontextprotocol/modelc…
olaservo Nov 14, 2025
c1621d0
Fix docstring
olaservo Nov 14, 2025
9f9b3a1
Merge branch 'main' into clarify-json-schema-version
olaservo Nov 14, 2025
5c4a992
Temporarily add even hackier version for posterity
olaservo Nov 14, 2025
69adf1b
De-zoddify
olaservo Nov 14, 2025
f870566
Go back to simple version
olaservo Nov 14, 2025
45bc08f
Merge branch 'main' into clarify-json-schema-version
olaservo Nov 14, 2025
7ff1511
Regenerate schema md
olaservo Nov 14, 2025
49637ea
Remove accidentally generated file
olaservo Nov 14, 2025
eee9af6
Clean up more zodded
olaservo Nov 14, 2025
7866033
Merge branch 'main' of https://github.com/modelcontextprotocol/modelc…
olaservo Nov 14, 2025
0aae433
Regenerate schemas
olaservo Nov 14, 2025
e9d025d
Merge branch 'main' into clarify-json-schema-version
olaservo Nov 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 55 additions & 3 deletions docs/specification/draft/basic/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ and instead retrieve credentials from the environment.
Additionally, clients and servers **MAY** negotiate their own custom authentication and
authorization strategies.

For further discussions and contributions to the evolution of MCPs auth mechanisms, join
For further discussions and contributions to the evolution of MCP's auth mechanisms, join
us in
[GitHub Discussions](https://github.com/modelcontextprotocol/specification/discussions)
to help shape the future of the protocol!
Expand All @@ -120,9 +120,61 @@ There is also a
which is automatically generated from the TypeScript source of truth, for use with
various automated tooling.

### General fields
## JSON Schema Usage

#### `_meta`
The Model Context Protocol uses JSON Schema for validation throughout the protocol. This section clarifies how JSON Schema should be used within MCP messages.

### Schema Dialect

MCP supports JSON Schema with the following rules:

1. **Default dialect**: When a schema does not include a `$schema` field, it defaults to JSON Schema 2020-12 (`https://json-schema.org/draft/2020-12/schema`)
1. **Explicit dialect**: Schemas MAY include a `$schema` field to specify a different dialect
1. **Supported dialects**: Implementations MUST support at least 2020-12 and SHOULD document which additional dialects they support
1. **Recommendation**: Implementors are RECOMMENDED to use JSON Schema 2020-12.

### Example Usage

#### Default dialect (2020-12):

```json
{
"type": "object",
"properties": {
"name": { "type": "string" },
"age": { "type": "integer", "minimum": 0 }
},
"required": ["name"]
}
```

#### Explicit dialect (draft-07):

```json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"name": { "type": "string" },
"age": { "type": "integer", "minimum": 0 }
},
"required": ["name"]
}
```

### Implementation Requirements

- Clients and servers **MUST** support JSON Schema 2020-12 for schemas without an explicit `$schema` field
- Clients and servers **MUST** validate schemas according to their declared or default dialect. They **MUST** handle unsupported dialects gracefully by returning an appropriate error indicating the dialect is not supported.
- Clients and servers **SHOULD** document which schema dialects they support

### Schema Validation

- Schemas **MUST** be valid according to their declared or default dialect

## General fields

### `_meta`

The `_meta` property/parameter is reserved by MCP to allow clients and servers
to attach additional metadata to their interactions.
Expand Down
10 changes: 6 additions & 4 deletions docs/specification/draft/schema.mdx

Large diffs are not rendered by default.

64 changes: 60 additions & 4 deletions docs/specification/draft/server/tools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,20 @@ A tool definition includes:
- `title`: Optional human-readable name of the tool for display purposes.
- `description`: Human-readable description of functionality
- `inputSchema`: JSON Schema defining expected parameters
- Follows the [JSON Schema usage guidelines](/specification/draft/basic#json-schema-usage)
Copy link
Member

Choose a reason for hiding this comment

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

Will this link point to /draft/ now and be edited later to point to /2025-11-24/? How are such links being handled in general?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question, do you think its better not to link directly here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I feel like @jonathanhefner might have ideas or thoughts on this? :)

- Defaults to 2020-12 if no `$schema` field is present
- **MUST** be a valid JSON Schema object (not `null`)
- For tools with no parameters, use one of these valid approaches:
Copy link
Member Author

@olaservo olaservo Nov 13, 2025

Choose a reason for hiding this comment

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

We chatted about whether this guidance is really needed here, since technically the schema for MCP already says that it has to be an object.

However, the original GitHub discussions showed widespread confusion around this, especially since JSON Schema 2020-12 would allow boolean schemas like true for no-parameter cases, but MCP requires an object. Given this is an MCP-specific restriction, it seems worth calling out explicitly in the spec verbiage.

Copy link
Member Author

Choose a reason for hiding this comment

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

@dsp-ant I left this extra explanation in, but didn't add anything explicit for other schemas (such as output schemas) because this seemed to be the main need for extra clarification.

- `{ "type": "object", "additionalProperties": false }` - **Recommended**: explicitly accepts only empty objects
- `{ "type": "object" }` - accepts any object (including with properties)
- `outputSchema`: Optional JSON Schema defining expected output structure
- Follows the [JSON Schema usage guidelines](/specification/draft/basic#json-schema-usage)
- Defaults to 2020-12 if no `$schema` field is present
- `annotations`: optional properties describing tool behavior

<Warning>

For trust & safety and security, clients **MUST** consider
tool annotations to be untrusted unless they come from trusted servers.

For trust & safety and security, clients **MUST** consider tool annotations to
be untrusted unless they come from trusted servers.
</Warning>

#### Tool Names
Expand Down Expand Up @@ -390,6 +396,56 @@ Providing an output schema helps clients and LLMs understand and properly handle
- Guiding clients and LLMs to properly parse and utilize the returned data
- Supporting better documentation and developer experience

### Schema Examples

#### Tool with default 2020-12 schema:

```json
{
"name": "calculate_sum",
"description": "Add two numbers",
"inputSchema": {
"type": "object",
"properties": {
"a": { "type": "number" },
"b": { "type": "number" }
},
"required": ["a", "b"]
}
}
```

#### Tool with explicit draft-07 schema:

```json
{
"name": "calculate_sum",
"description": "Add two numbers",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"a": { "type": "number" },
"b": { "type": "number" }
},
"required": ["a", "b"]
}
}
```

#### Tool with no parameters:

```json
{
"name": "get_current_time",
"description": "Returns the current server time",
"inputSchema": {
"type": "object",
"additionalProperties": false
}
}
```

## Error Handling

Tools use two error reporting mechanisms:
Expand Down
Loading