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
Copy file name to clipboardExpand all lines: docs/specification/server/resources.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -173,6 +173,17 @@ Resource templates allow servers to expose parameterized resources using [URI te
173
173
}
174
174
```
175
175
176
+
### List Changed Notification
177
+
178
+
When the list of available resources changes, servers that declared the `listChanged` capability **SHOULD** send a notification:
179
+
180
+
```json
181
+
{
182
+
"jsonrpc": "2.0",
183
+
"method": "notifications/resources/list_changed"
184
+
}
185
+
```
186
+
176
187
### Subscriptions
177
188
178
189
The protocol supports optional subscriptions to resource changes. Clients can subscribe to specific resources and receive notifications when they change:
The Model Context Protocol (MCP) allows servers to expose tools that can be invoked by language models through clients. Tools enable models to perform actions or retrieve information beyond their training data, such as querying databases, calling external APIs, or executing commands. Each tool is uniquely identified by a name and includes metadata describing its capabilities and requirements.
11
+
The Model Context Protocol (MCP) allows servers to expose tools that can be invoked by language models. Tools enable models to interact with external systems, such as querying databases, calling APIs, or performing computations. Each tool is uniquely identified by a name and includes metadata describing its schema.
12
12
13
13
## User Interaction Model
14
14
15
-
Tools in MCP are commonly surfaced through AI assistant or chatbot interfaces, where the language model can discover and invoke tools based on the conversation context. A recommended pattern is displaying available tools in the chat interface with visual indicators when they are invoked, along with confirmation prompts for sensitive operations.
15
+
Tools in MCP are designed to be **model-controlled**, meaning that the language model can discover and invoke tools automatically based on its contextual understanding and the user's prompts.
16
16
17
-
However, implementations are free to expose tools through any interface pattern that suits their needs - the protocol itself does not mandate any specific user interaction model.
17
+
However, implementations are free to expose tools through any interface pattern that suits their needs—the protocol itself does not mandate any specific user interaction model.
18
18
19
-
## Capabilities
20
-
21
-
Servers that support tools MUST include a `tools` capability in their `ServerCapabilities` during initialization. The basic tools capability can be specified with an empty object:
19
+
{{< callout type="warning" >}}
20
+
For trust & safety and security, there **SHOULD** always be a human in the loop with the ability to deny tool invocations.
21
+
22
+
Applications **SHOULD**:
23
+
* Provide UI that makes clear which tools are being exposed to the AI model
24
+
* Insert clear visual indicators when tools are invoked
25
+
* Present confirmation prompts to the user for operations, to ensure a human is in the loop
26
+
{{< /callout >}}
22
27
23
-
```json
24
-
{
25
-
"capabilities": {
26
-
"tools": {}
27
-
}
28
-
}
29
-
```
28
+
## Capabilities
30
29
31
-
For servers that support notifications about tool list changes, the optional `listChanged` property should be set to true:
30
+
Servers that support tools **MUST** declare the `tools` capability:
32
31
33
32
```json
34
33
{
@@ -40,13 +39,13 @@ For servers that support notifications about tool list changes, the optional `li
40
39
}
41
40
```
42
41
43
-
The `listChanged`property indicates that the server supports notifications about changes to the tool list. When omitted or set to false, clients should not expect to receive tool list change notifications.
42
+
`listChanged` indicates whether the server will emit notifications when the list of available tools changes.
44
43
45
44
## Protocol Messages
46
45
47
46
### Listing Tools
48
47
49
-
To discover available tools, clients send a `tools/list` request. This operation supports pagination through the standard cursor mechanism.
48
+
To discover available tools, clients send a `tools/list` request. This operation supports [pagination]({{< ref "/specification/server/utilities/pagination" >}}).
50
49
51
50
**Request:**
52
51
```json
@@ -123,7 +122,7 @@ To invoke a tool, clients send a `tools/call` request:
123
122
124
123
### List Changed Notification
125
124
126
-
When tools change, servers that support `listChanged`MAY send a notification:
125
+
When the list of available tools changes, servers that declared the `listChanged`capability **SHOULD** send a notification:
127
126
128
127
```json
129
128
{
@@ -190,6 +189,9 @@ Tool results can contain multiple content items of different types:
190
189
```
191
190
192
191
#### Embedded Resources
192
+
193
+
[Resources]({{< ref "/specification/server/resources" >}}) **MAY** be embedded, to provide additional context or data, behind a URI that can be subscribed to or fetched again by the client later:
194
+
193
195
```json
194
196
{
195
197
"type": "resource",
@@ -205,12 +207,12 @@ Tool results can contain multiple content items of different types:
205
207
206
208
Tools use two error reporting mechanisms:
207
209
208
-
1. Protocol Errors: Standard JSON-RPC errors for issues like:
210
+
1.**Protocol Errors**: Standard JSON-RPC errors for issues like:
209
211
- Unknown tools
210
212
- Invalid arguments
211
213
- Server errors
212
214
213
-
2. Tool Execution Errors: Reported in successful responses with `isError: true`:
215
+
2.**Tool Execution Errors**: Reported in tool results with `isError: true`:
214
216
- API failures
215
217
- Invalid input data
216
218
- Business logic errors
@@ -244,21 +246,15 @@ Example tool execution error:
244
246
245
247
## Security Considerations
246
248
247
-
1. Servers MUST:
249
+
1. Servers **MUST**:
248
250
- Validate all tool inputs
249
251
- Implement proper access controls
250
252
- Rate limit tool invocations
251
253
- Sanitize tool outputs
252
254
253
-
2. Clients SHOULD:
255
+
2. Clients **SHOULD**:
254
256
- Prompt for user confirmation on sensitive operations
257
+
- Show tool inputs to the user before calling the server, to avoid malicious or accidental data exfiltration
0 commit comments