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
@@ -140,6 +143,30 @@ To request information from a user, servers send an `elicitation/create` request
140
143
}
141
144
```
142
145
146
+
**Decline Response Example:**
147
+
148
+
```json
149
+
{
150
+
"jsonrpc": "2.0",
151
+
"id": 2,
152
+
"result": {
153
+
"action": "decline"
154
+
}
155
+
}
156
+
```
157
+
158
+
**Cancel Response Example:**
159
+
160
+
```json
161
+
{
162
+
"jsonrpc": "2.0",
163
+
"id": 2,
164
+
"result": {
165
+
"action": "cancel"
166
+
}
167
+
}
168
+
```
169
+
143
170
## Message Flow
144
171
145
172
```mermaid
@@ -163,14 +190,15 @@ sequenceDiagram
163
190
164
191
## Request Schema
165
192
166
-
The `requestedSchema` 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:
193
+
The `requestedSchema` field allows servers to define the structure of the expected response using a restricted subset of JSON Schema. To simplify implementation for clients, elicitation schemas are limited to flat objects with primitive properties only:
167
194
168
195
```json
169
196
"requestedSchema": {
170
197
"type": "object",
171
198
"properties": {
172
199
"propertyName": {
173
200
"type": "string",
201
+
"title": "Display Name",
174
202
"description": "Description of the property"
175
203
},
176
204
"anotherProperty": {
@@ -183,70 +211,106 @@ The `requestedSchema` field allows servers to define the structure of the expect
Note that complex nested structures, arrays of objects, and other advanced JSON Schema features are intentionally not supported to simplify client implementation.
198
270
199
-
Responses to elicitation requests contain a content object with key-value pairs:
271
+
## Response Actions
200
272
201
-
```json
202
-
"content": {
203
-
"propertyName": "value",
204
-
"anotherProperty": 42
205
-
}
206
-
```
207
-
208
-
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.
209
-
210
-
## Error Handling
211
-
212
-
Clients **SHOULD** return standard JSON-RPC errors for common failure cases:
213
-
214
-
Example when the user cancels:
273
+
Elicitation responses use a three-action model to clearly distinguish between different user actions:
215
274
216
275
```json
217
276
{
218
277
"jsonrpc": "2.0",
219
278
"id": 1,
220
-
"error": {
221
-
"code": -1,
222
-
"message": "User rejected the elicitation request"
279
+
"result": {
280
+
"action": "accept", // or "decline" or "cancel"
281
+
"content": {
282
+
"propertyName": "value",
283
+
"anotherProperty": 42
284
+
}
223
285
}
224
286
}
225
287
```
226
288
227
-
Example when validation fails:
289
+
The three response actions are:
228
290
229
-
```json
230
-
{
231
-
"jsonrpc": "2.0",
232
-
"id": 1,
233
-
"error": {
234
-
"code": -32602,
235
-
"message": "Invalid parameters",
236
-
"data": {
237
-
"validationErrors": {
238
-
"email": "Invalid email format"
239
-
}
240
-
}
241
-
}
242
-
}
243
-
```
291
+
1.**Accept** (`action: "accept"`): User explicitly approved and submitted the form with data
292
+
- The `content` field contains the submitted data matching the requested schema
293
+
- Example: User clicked "Submit", "OK", "Confirm", etc.
294
+
295
+
2.**Decline** (`action: "decline"`): User explicitly rejected the request
296
+
- The `content` field is typically omitted
297
+
- Example: User clicked "Decline", "Reject", "No", etc.
298
+
299
+
3.**Cancel** (`action: "cancel"`): User dismissed without making an explicit choice
300
+
- The `content` field is typically omitted
301
+
- Example: User closed the dialog, clicked outside, pressed Escape, etc.
0 commit comments