Skip to content

Commit c5dba5e

Browse files
committed
Update prompts.md
1 parent 5669938 commit c5dba5e

File tree

1 file changed

+23
-32
lines changed

1 file changed

+23
-32
lines changed

docs/specification/server/prompts.md

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,19 @@ The Model Context Protocol (MCP) provides a standardized way for servers to expo
1111

1212
## User Interaction Model
1313

14-
Prompts in MCP are commonly implemented through user-initiated interactions. One recommended implementation pattern is exposing prompts through user-initiated commands in the user interface, which allows users to naturally discover and invoke available prompts. An example of this pattern are slash commands.
14+
Prompts are designed to be **user-controlled**, meaning they are exposed from servers to clients with the intention of the user being able to explicitly select them for use.
15+
16+
Typically, prompts would be triggered through user-initiated commands in the user interface, which allows users to naturally discover and invoke available prompts.
17+
18+
For example, as slash commands:
1519

1620
![Example of prompt exposed as slash command](slash-command.png)
1721

18-
However, implementors are free to expose prompts through any interface pattern that suits their needs - the protocol itself does not mandate any specific user interaction model.
22+
However, implementors are free to expose prompts through any interface pattern that suits their needs—the protocol itself does not mandate any specific user interaction model.
1923

2024
## Capabilities
2125

22-
Servers that support prompts MUST include a `prompts` capability in their `ServerCapabilities` during initialization:
26+
Servers that support prompts **MUST** declare the `prompts` capability during [initialization]({{< ref "/specification/basic/lifecycle#initialization" >}}):
2327
```json
2428
{
2529
"capabilities": {
@@ -30,23 +34,13 @@ Servers that support prompts MUST include a `prompts` capability in their `Serve
3034
}
3135
```
3236

33-
To omit change notifications, the server would not include `listChanged`:
34-
35-
```json
36-
{
37-
"capabilities": {
38-
"prompts": {}
39-
}
40-
}
41-
```
42-
43-
The `listChanged` property indicates that the server supports notifications about changes to the prompt list.
37+
`listChanged` indicates whether the server will emit notifications when the list of available prompts changes.
4438

4539
## Protocol Messages
4640

4741
### Listing Prompts
4842

49-
To retrieve available prompts, clients send a `prompts/list` request. This operation supports pagination through the standard cursor mechanism.
43+
To retrieve available prompts, clients send a `prompts/list` request. This operation supports [pagination]({{< ref "/specification/server/utilities/pagination" >}}).
5044

5145
**Request:**
5246
```json
@@ -69,7 +63,7 @@ To retrieve available prompts, clients send a `prompts/list` request. This opera
6963
"prompts": [
7064
{
7165
"name": "code_review",
72-
"description": "Analyze code quality and suggest improvements",
66+
"description": "Asks the LLM to analyze code quality and suggest improvements",
7367
"arguments": [
7468
{
7569
"name": "code",
@@ -86,7 +80,7 @@ To retrieve available prompts, clients send a `prompts/list` request. This opera
8680

8781
### Getting a Prompt
8882

89-
To retrieve a specific prompt, clients send a `prompts/get` request. Arguments support auto-completion through [the completion API]({{< relref "utilities/completion.md" >}}):
83+
To retrieve a specific prompt, clients send a `prompts/get` request. Arguments may be auto-completed through [the completion API]({{< ref "/specification/server/utilities/completion" >}})):
9084

9185
**Request:**
9286
```json
@@ -115,7 +109,7 @@ To retrieve a specific prompt, clients send a `prompts/get` request. Arguments s
115109
"role": "user",
116110
"content": {
117111
"type": "text",
118-
"text": "Please review this code..."
112+
"text": "Please review this Python code:\ndef hello():\n print('world')"
119113
}
120114
}
121115
]
@@ -125,7 +119,7 @@ To retrieve a specific prompt, clients send a `prompts/get` request. Arguments s
125119

126120
### List Changed Notification
127121

128-
When prompts change, servers that support `listChanged` MAY send a notification:
122+
When the list of available prompts changes, servers that declared the `listChanged` capability **SHOULD** send a notification:
129123

130124
```json
131125
{
@@ -149,10 +143,12 @@ sequenceDiagram
149143
Client->>Server: prompts/get
150144
Server-->>Client: Prompt content
151145
152-
Note over Client,Server: Changes
153-
Server--)Client: prompts/list_changed
154-
Client->>Server: prompts/list
155-
Server-->>Client: Updated prompts
146+
opt listChanged
147+
Note over Client,Server: Changes
148+
Server--)Client: prompts/list_changed
149+
Client->>Server: prompts/list
150+
Server-->>Client: Updated prompts
151+
end
156152
```
157153

158154
## Data Types
@@ -223,15 +219,10 @@ Servers SHOULD return standard JSON-RPC errors for common failure cases:
223219

224220
## Implementation Considerations
225221

226-
1. Servers SHOULD validate prompt arguments before processing
227-
2. Clients SHOULD handle pagination for large prompt lists
228-
3. Both parties SHOULD respect capability negotiation
222+
1. Servers **SHOULD** validate prompt arguments before processing
223+
2. Clients **SHOULD** handle pagination for large prompt lists
224+
3. Both parties **SHOULD** respect capability negotiation
229225

230226
## Security
231227

232-
Implementations MUST carefully validate all prompt inputs and arguments to prevent injection attacks or unauthorized access to resources.
233-
234-
## See Also
235-
{{< cards >}}
236-
{{< card link="/server/utilities/completion" title="Completion API" icon="code" >}}
237-
{{< /cards >}}
228+
Implementations **MUST** carefully validate all prompt inputs and outputs to prevent injection attacks or unauthorized access to resources.

0 commit comments

Comments
 (0)