You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add capability flags to indicate whether a server supports sending notifications when its list of prompts, resources, or tools changes. This helps clients know whether to expect list_changed notifications.
Copy file name to clipboardExpand all lines: docs/spec/prompts.md
+46-12Lines changed: 46 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,35 @@ Prompts enable servers to provide templated conversations or instructions to cli
9
9
An example of a prompt as a slash command in the Zed editor:
10
10

11
11
12
+
## Capabilities
13
+
14
+
To indicate support for the Prompts API, servers MUST include a `prompts` capability in their `ServerCapabilities` during initialization. The `prompts` capability SHOULD be an empty object:
15
+
16
+
```json
17
+
{
18
+
"capabilities": {
19
+
"prompts": {}
20
+
}
21
+
```
22
+
23
+
Clients SHOULD check for this capability before using the Prompts API.
24
+
25
+
Servers MAY support notifications for changes to the prompt list. If a server supports this feature, it SHOULD include a `listChanged` property in its `prompts` capability:
26
+
27
+
```json
28
+
{
29
+
"capabilities": {
30
+
"prompts": {
31
+
"listChanged": true
32
+
}
33
+
}
34
+
}
35
+
```
36
+
37
+
If a server supports this capability, it MAY send `notifications/prompts/list_changed` notifications to inform the client about changes to the available prompts.
38
+
39
+
## Concepts
40
+
12
41
### Prompt
13
42
14
43
A Prompt in the Model Context Protocol (MCP) represents a pre-defined set of messages or instructions that a server can provide to clients. Each Prompt is uniquely identified by a name and may have associated metadata such as a description and required arguments. Prompts can represent various types of interactions, including code reviews, data analysis tasks, or creative writing prompts.
@@ -221,24 +250,29 @@ Example:
221
250
}
222
251
```
223
252
224
-
## Error Handling
225
-
226
-
Clients MUST be prepared to handle cases where listed prompts become unavailable between listing and retrieval attempts. Servers SHOULD provide appropriate error responses in such scenarios.
227
-
228
-
## Security Considerations
253
+
### Prompt List Changed Notification
229
254
230
-
Implementations MUST carefully consider the security implications of exposing prompts, especially when dealing with sensitive data or customizable templates. Proper authentication and authorization mechanisms SHOULD be in place to prevent unauthorized access to prompts.
255
+
If the server supports the `listChanged` capability for prompts, it MAY send a `notifications/prompts/list_changed` notification to inform the client that the list of available prompts has changed.
231
256
232
-
##Capabilities
257
+
#### Notification
233
258
234
-
To indicate support for the Prompts API, servers MUST include a `prompts` capability in their `ServerCapabilities` during initialization. The `prompts` capability SHOULD be an empty object:
259
+
Method: `notifications/prompts/list_changed`
260
+
Params: None
235
261
262
+
Example:
236
263
```json
237
264
{
238
-
"capabilities": {
239
-
"prompts": {}
240
-
}
265
+
"jsonrpc": "2.0",
266
+
"method": "notifications/prompts/list_changed"
241
267
}
242
268
```
243
269
244
-
Clients SHOULD check for this capability before using the Prompts API.
270
+
Upon receiving this notification, clients SHOULD request an updated prompt list using the `prompts/list` method to ensure they have the most up-to-date information about available prompts.
271
+
272
+
## Error Handling
273
+
274
+
Clients MUST be prepared to handle cases where listed prompts become unavailable between listing and retrieval attempts. Servers SHOULD provide appropriate error responses in such scenarios.
275
+
276
+
## Security Considerations
277
+
278
+
Implementations MUST carefully consider the security implications of exposing prompts, especially when dealing with sensitive data or customizable templates. Proper authentication and authorization mechanisms SHOULD be in place to prevent unauthorized access to prompts.
Copy file name to clipboardExpand all lines: docs/spec/resources.md
+10-7Lines changed: 10 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,9 +7,9 @@ weight: 4
7
7
8
8
Resources enable servers to expose arbitrary data to clients in a structured way, specifically for providing context to language models. Clients can discover available resources, read their contents, and optionally subscribe to updates. Users may explicitly attach resources via the client UI, or clients can intelligently select appropriate resources to add to the context. Each resource is uniquely identified by a [URI](https://datatracker.ietf.org/doc/html/rfc3986).
9
9
10
-
## Required Capabilities
10
+
## Capabilities
11
11
12
-
To use resources, the server MUST include the `resources` capability in its `ServerCapabilities` object during the initialization process. The `resources` capability MAY include a `subscribe` field set to `true` if the server supports resource subscriptions.
12
+
To use resources, the server MUST include the `resources` capability in its `ServerCapabilities` object during the initialization process. The `resources` capability MAY include a `subscribe` field set to `true` if the server supports resource subscriptions. Additionally, the `resources` capability MAY include a `listChanged` field set to `true` if the server supports notifications for changes to the resource list.
13
13
14
14
Clients intending to use resources SHOULD check for the presence of the `resources` capability in the server's capabilities before attempting to use any resource-related methods. If the capability is not present, the client MUST NOT attempt to use resource-related methods, as the server does not support them.
15
15
@@ -22,19 +22,20 @@ Example of server capabilities with basic resource support:
22
22
}
23
23
```
24
24
25
-
Example of server capabilities including resource support:
25
+
Example of server capabilities including resource support with subscriptions and list change notifications:
26
26
27
27
```json
28
28
{
29
29
"capabilities": {
30
30
"resources": {
31
-
"subscribe": true
31
+
"subscribe": true,
32
+
"listChanged": true
32
33
}
33
34
}
34
35
}
35
36
```
36
37
37
-
In this example, the server supports both basic resource operationsand subscriptions. If `subscribe` is omitted or set to `false`, the server only supports basic resource operations without subscriptions.
38
+
In this example, the server supports basic resource operations, subscriptions, and notifications for resource list changes. If `subscribe` is omitted or set to `false`, the server only supports basic resource operations without subscriptions. Similarly, if `listChanged` is omitted or set to `false`, the server does not support notifications for changes to the resource list.
38
39
39
40
## Concepts
40
41
### Resource
@@ -345,7 +346,9 @@ Servers MUST only send this notification for resources that clients have explici
345
346
346
347
### Resource List Changed Notification
347
348
348
-
When the list of available resources has changed, the server MUST send a `notifications/resources/list_changed` notification to the client.
349
+
If the server supports the `listChanged` capability for resources, it MAY send a `notifications/resources/list_changed` notification to inform the client that the list of available resources has changed.
350
+
351
+
#### Notification
349
352
350
353
Method: `notifications/resources/list_changed`
351
354
Params: None
@@ -358,7 +361,7 @@ Example:
358
361
}
359
362
```
360
363
361
-
Upon receiving this notification, clients SHOULD request an updated resource list using the `resources/list` method.
364
+
Upon receiving this notification, clients SHOULD request an updated resource list using the `resources/list` method to ensure they have the most up-to-date information about available resources.
0 commit comments