Skip to content

Commit 3cbdc46

Browse files
authored
Merge pull request modelcontextprotocol#891 from modelcontextprotocol/feat/resource-annotations
Include Annotations for Content types and Resources in documentation
2 parents 8674c10 + 42da63e commit 3cbdc46

File tree

6 files changed

+125
-4
lines changed

6 files changed

+125
-4
lines changed

docs/specification/2025-06-18/server/prompts.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ Messages in a prompt can contain:
186186
- `role`: Either "user" or "assistant" to indicate the speaker
187187
- `content`: One of the following content types:
188188

189+
<Note>
190+
All content types in prompt messages support optional
191+
[annotations](/specification/2025-06-18/server/resources#annotations) for
192+
metadata about audience, priority, and modification times.
193+
</Note>
194+
189195
#### Text Content
190196

191197
Text content represents plain text messages:

docs/specification/2025-06-18/server/resources.mdx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,36 @@ Resources can contain either text or binary data:
305305
}
306306
```
307307

308+
### Annotations
309+
310+
Resources, resource templates and content blocks support optional annotations that provide hints to clients about how to use or display the resource:
311+
312+
- **`audience`**: An array indicating the intended audience(s) for this resource. Valid values are `"user"` and `"assistant"`. For example, `["user", "assistant"]` indicates content useful for both.
313+
- **`priority`**: A number from 0.0 to 1.0 indicating the importance of this resource. A value of 1 means "most important" (effectively required), while 0 means "least important" (entirely optional).
314+
- **`lastModified`**: An ISO 8601 formatted timestamp indicating when the resource was last modified (e.g., `"2025-01-12T15:00:58Z"`).
315+
316+
Example resource with annotations:
317+
318+
```json
319+
{
320+
"uri": "file:///project/README.md",
321+
"name": "README.md",
322+
"title": "Project Documentation",
323+
"mimeType": "text/markdown",
324+
"annotations": {
325+
"audience": ["user"],
326+
"priority": 0.8,
327+
"lastModified": "2025-01-12T15:00:58Z"
328+
}
329+
}
330+
```
331+
332+
Clients can use these annotations to:
333+
334+
- Filter resources based on their intended audience
335+
- Prioritize which resources to include in context
336+
- Display modification times or sort by recency
337+
308338
## Common URI Schemes
309339

310340
The protocol defines several standard URI schemes. This list not

docs/specification/2025-06-18/server/tools.mdx

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,14 @@ Tool results may contain [**structured**](#structured-content) or **unstructured
203203

204204
**Unstructured** content is returned in the `content` field of a result, and can contain multiple content items of different types:
205205

206+
<Note>
207+
All content types (text, image, audio, resource links, and embedded resources)
208+
support optional
209+
[annotations](/specification/2025-06-18/server/resources#annotations) that
210+
provide metadata about audience, priority, and modification times. This is the
211+
same annotation format used by resources and prompts.
212+
</Note>
213+
206214
#### Text Content
207215

208216
```json
@@ -219,9 +227,16 @@ Tool results may contain [**structured**](#structured-content) or **unstructured
219227
"type": "image",
220228
"data": "base64-encoded-data",
221229
"mimeType": "image/png"
230+
"annotations": {
231+
"audience": ["user"],
232+
"priority": 0.9
233+
}
234+
222235
}
223236
```
224237

238+
This example demonstrates the use of an optional Annotation.
239+
225240
#### Audio Content
226241

227242
```json
@@ -243,10 +258,16 @@ or data. In this case, the tool will return a URI that can be subscribed to or f
243258
"uri": "file:///project/src/main.rs",
244259
"name": "main.rs",
245260
"description": "Primary application entry point",
246-
"mimeType": "text/x-rust"
261+
"mimeType": "text/x-rust",
262+
"annotations": {
263+
"audience": ["assistant"],
264+
"priority": 0.9
265+
}
247266
}
248267
```
249268

269+
Resource links support the same [Resource annotations](/specification/2025-06-18/server/resources#annotations) as regular resources to help clients understand how to use them.
270+
250271
<Info>
251272
Resource links returned by tools are not guaranteed to appear in the results
252273
of a `resources/list` request.
@@ -264,11 +285,18 @@ or data using a suitable [URI scheme](./resources#common-uri-schemes). Servers t
264285
"uri": "file:///project/src/main.rs",
265286
"title": "Project Rust Main File",
266287
"mimeType": "text/x-rust",
267-
"text": "fn main() {\n println!(\"Hello world!\");\n}"
288+
"text": "fn main() {\n println!(\"Hello world!\");\n}",
289+
"annotations": {
290+
"audience": ["user", "assistant"],
291+
"priority": 0.7,
292+
"lastModified": "2025-05-03T14:30:00Z"
293+
}
268294
}
269295
}
270296
```
271297

298+
Embedded resources support the same [Resource annotations](/specification/2025-06-18/server/resources#annotations) as regular resources to help clients understand how to use them.
299+
272300
#### Structured Content
273301

274302
**Structured** content is returned as a JSON object in the `structuredContent` field of a result.

docs/specification/draft/server/prompts.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ Messages in a prompt can contain:
186186
- `role`: Either "user" or "assistant" to indicate the speaker
187187
- `content`: One of the following content types:
188188

189+
<Note>
190+
All content types in prompt messages support optional
191+
[annotations](/specification/2025-06-18/server/resources#annotations) for
192+
metadata about audience, priority, and modification times.
193+
</Note>
194+
189195
#### Text Content
190196

191197
Text content represents plain text messages:

docs/specification/draft/server/resources.mdx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,36 @@ Resources can contain either text or binary data:
305305
}
306306
```
307307

308+
### Annotations
309+
310+
Resources, resource templates and content blocks support optional annotations that provide hints to clients about how to use or display the resource:
311+
312+
- **`audience`**: An array indicating the intended audience(s) for this resource. Valid values are `"user"` and `"assistant"`. For example, `["user", "assistant"]` indicates content useful for both.
313+
- **`priority`**: A number from 0.0 to 1.0 indicating the importance of this resource. A value of 1 means "most important" (effectively required), while 0 means "least important" (entirely optional).
314+
- **`lastModified`**: An ISO 8601 formatted timestamp indicating when the resource was last modified (e.g., `"2025-01-12T15:00:58Z"`).
315+
316+
Example resource with annotations:
317+
318+
```json
319+
{
320+
"uri": "file:///project/README.md",
321+
"name": "README.md",
322+
"title": "Project Documentation",
323+
"mimeType": "text/markdown",
324+
"annotations": {
325+
"audience": ["user"],
326+
"priority": 0.8,
327+
"lastModified": "2025-01-12T15:00:58Z"
328+
}
329+
}
330+
```
331+
332+
Clients can use these annotations to:
333+
334+
- Filter resources based on their intended audience
335+
- Prioritize which resources to include in context
336+
- Display modification times or sort by recency
337+
308338
## Common URI Schemes
309339

310340
The protocol defines several standard URI schemes. This list not

docs/specification/draft/server/tools.mdx

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,14 @@ Tool results may contain [**structured**](#structured-content) or **unstructured
203203

204204
**Unstructured** content is returned in the `content` field of a result, and can contain multiple content items of different types:
205205

206+
<Note>
207+
All content types (text, image, audio, resource links, and embedded resources)
208+
support optional
209+
[annotations](/specification/draft/server/resources#annotations) that provide
210+
metadata about audience, priority, and modification times. This is the same
211+
annotation format used by resources and prompts.
212+
</Note>
213+
206214
#### Text Content
207215

208216
```json
@@ -218,7 +226,11 @@ Tool results may contain [**structured**](#structured-content) or **unstructured
218226
{
219227
"type": "image",
220228
"data": "base64-encoded-data",
221-
"mimeType": "image/png"
229+
"mimeType": "image/png",
230+
"annotations": {
231+
"audience": ["user"],
232+
"priority": 0.9
233+
}
222234
}
223235
```
224236

@@ -247,6 +259,8 @@ or data. In this case, the tool will return a URI that can be subscribed to or f
247259
}
248260
```
249261

262+
Resource links support the same [Resource annotations](/specification/draft/server/resources#annotations) as regular resources to help clients understand how to use them.
263+
250264
<Info>
251265
Resource links returned by tools are not guaranteed to appear in the results
252266
of a `resources/list` request.
@@ -264,11 +278,18 @@ or data using a suitable [URI scheme](./resources#common-uri-schemes). Servers t
264278
"uri": "file:///project/src/main.rs",
265279
"title": "Project Rust Main File",
266280
"mimeType": "text/x-rust",
267-
"text": "fn main() {\n println!(\"Hello world!\");\n}"
281+
"text": "fn main() {\n println!(\"Hello world!\");\n}",
282+
"annotations": {
283+
"audience": ["user", "assistant"],
284+
"priority": 0.7,
285+
"lastModified": "2025-05-03T14:30:00Z"
286+
}
268287
}
269288
}
270289
```
271290

291+
Embedded resources support the same [Resource annotations](/specification/draft/server/resources#annotations) as regular resources to help clients understand how to use them.
292+
272293
#### Structured Content
273294

274295
**Structured** content is returned as a JSON object in the `structuredContent` field of a result.

0 commit comments

Comments
 (0)