Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
61 changes: 61 additions & 0 deletions docs/specification/draft/basic/patterns/subscriptions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,67 @@ with their originating subscription.
}
```

## Embedded Resources

It is also possible to directly embed a resource together with the `notifications/resources/updated` event to avoid an extra round of reading, and avoid race conditions if another update is done before the reading actually happens. For this, the client **MUST** first query this embedding by adding a field `embedResources: true` in the `params` field when calling `subscriptions/listen`:

```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "subscriptions/listen",
"params": {
"_meta": {
"io.modelcontextprotocol/protocolVersion": "2026-07-28",
"io.modelcontextprotocol/clientInfo": {
"name": "ExampleClient",
"version": "1.0.0"
},
"io.modelcontextprotocol/clientCapabilities": {}
},
"notifications": {
"toolsListChanged": true,
"resourceSubscriptions": ["file:///project/config.json"]
},
"embedResources": true
}
}
```

The `notifications/resources/updated` call **MUST** then provide the attached resource as:

```json
{
"jsonrpc": "2.0",
"method": "notifications/resources/updated",
"params": {
"_meta": {
"io.modelcontextprotocol/subscriptionId": 1
},
"uri": "file:///project/config.json",
"mimeType": "application/json",
"text": "{foo: 42}"
}
}
```

When the resource is a structured content, the `structuredContent` and the optional `contentSchema` are attached similarly:

```json
{
"jsonrpc": "2.0",
"method": "notifications/resources/updated",
"params": {
"_meta": {
"io.modelcontextprotocol/subscriptionId": 1
},
"uri": "file:///project/config.json",
"contentSchema": "file:///config_schema.json",
"structuredContent": { "foo": 42 }
}
}
```

## Multiple Concurrent Subscriptions

A client **MAY** have multiple active subscriptions concurrently — for example,
Expand Down
14 changes: 14 additions & 0 deletions docs/specification/draft/server/resources.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,20 @@ Resources can contain either text or binary data:
}
```

#### Structured Content

Structured content can be embedded inside a `structuredContent` field. An optional `contentSchema` field **MAY** be included, pointing to a resource containing the schema of this content:

```json
{
"uri": "file:///config.json",
"contentSchema": "file:///config_schema.json",
"structuredContent": { "foo": 42 }
}
```

When `contentSchema` is provided, clients **SHOULD** validate the structured content based on the schema included in the resource pointed by `contentSchema`. If the resource pointed by `contentSchema` is itself a structured content, this content is directly used as the schema. If it is a text content, the `text` should be parsed as a JSON string used as the schema. If it is a binary content, the `blob` **MUST** first be decoded as an UTF-8 string and parsed as a JSON string.

### Annotations

Resources, resource templates and content blocks support optional annotations that provide hints to clients about how to use or display the resource:
Expand Down
Loading