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
Note over Server: Continue processing with new information
138
153
```
139
154
140
-
## Data Types
141
-
142
-
### Elicitation Content
155
+
## Request Schema
143
156
144
-
Responses to elicitation requests can contain an array of content items:
157
+
The `requestSchema` field allows servers to define the structure of the expected response using JSON Schema. This follows the same pattern as the `inputSchema` field in the Tool interface:
Responses to elicitation requests contain a content object with key-value pairs:
177
191
178
192
```json
179
-
{
180
-
"type": "image",
181
-
"data": "base64-encoded-image-data",
182
-
"mimeType": "image/jpeg"
193
+
"content": {
194
+
"propertyName": "value",
195
+
"anotherProperty": 42
183
196
}
184
197
```
185
198
186
-
#### Audio Content
187
-
188
-
```json
189
-
{
190
-
"type": "audio",
191
-
"data": "base64-encoded-audio-data",
192
-
"mimeType": "audio/wav"
193
-
}
194
-
```
199
+
The structure of this object should match the schema provided in the request, if one was specified. If no schema was provided, the client can structure the response as appropriate for the use case.
195
200
196
201
## Error Handling
197
202
@@ -210,10 +215,29 @@ Example when the user cancels:
210
215
}
211
216
```
212
217
218
+
Example when validation fails:
219
+
220
+
```json
221
+
{
222
+
"jsonrpc": "2.0",
223
+
"id": 1,
224
+
"error": {
225
+
"code": -32602,
226
+
"message": "Invalid parameters",
227
+
"data": {
228
+
"validationErrors": {
229
+
"email": "Invalid email format"
230
+
}
231
+
}
232
+
}
233
+
}
234
+
```
235
+
213
236
## Security Considerations
214
237
215
238
1. Clients **SHOULD** implement user approval controls
216
-
2. Both parties **SHOULD** validate elicitation content
239
+
2. Both parties **SHOULD** validate elicitation content against the provided schema
217
240
3. Clients **SHOULD** provide clear indication of which server is requesting information
218
241
4. Clients **SHOULD** allow users to cancel elicitation requests at any time
219
-
5. Structured output should be validated against the provided schema when possible
242
+
5. Servers **SHOULD NOT** request sensitive information (passwords, tokens) through elicitation
243
+
6. Clients **SHOULD** sanitize inputs to prevent injection attacks
Copy file name to clipboardExpand all lines: schema/draft/schema.json
+30-15Lines changed: 30 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -488,6 +488,33 @@
488
488
"message": {
489
489
"description": "The message to present to the user.",
490
490
"type": "string"
491
+
},
492
+
"requestSchema": {
493
+
"description": "A JSON Schema object defining the expected structure of the response.\nThis follows the same pattern as the inputSchema in Tool interface.",
494
+
"properties": {
495
+
"properties": {
496
+
"additionalProperties": {
497
+
"additionalProperties": true,
498
+
"properties": {},
499
+
"type": "object"
500
+
},
501
+
"type": "object"
502
+
},
503
+
"required": {
504
+
"items": {
505
+
"type": "string"
506
+
},
507
+
"type": "array"
508
+
},
509
+
"type": {
510
+
"const": "object",
511
+
"type": "string"
512
+
}
513
+
},
514
+
"required": [
515
+
"type"
516
+
],
517
+
"type": "object"
491
518
}
492
519
},
493
520
"required": [
@@ -511,21 +538,9 @@
511
538
"type": "object"
512
539
},
513
540
"content": {
514
-
"description": "The user's response to the elicitation request.",
515
-
"items": {
516
-
"anyOf": [
517
-
{
518
-
"$ref": "#/definitions/TextContent"
519
-
},
520
-
{
521
-
"$ref": "#/definitions/ImageContent"
522
-
},
523
-
{
524
-
"$ref": "#/definitions/AudioContent"
525
-
}
526
-
]
527
-
},
528
-
"type": "array"
541
+
"additionalProperties": {},
542
+
"description": "The user's response to the elicitation request.\nThis follows the same pattern as arguments in tool calls.",
0 commit comments