Skip to content

Commit 26bc30c

Browse files
committed
fix: Clear expectation for completion notification in URL elicitation
1 parent 0a0832c commit 26bc30c

File tree

4 files changed

+53
-22
lines changed

4 files changed

+53
-22
lines changed

docs/specification/draft/client/elicitation.mdx

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -334,15 +334,21 @@ URL mode elicitation enables servers to direct users to external URLs for out-of
334334
elicitation URL the server wants them to open.
335335
</Note>
336336

337-
URL mode elicitation requests **MUST** specify `mode: "url"` and include these additional parameters:
337+
URL mode elicitation requests **MUST** specify `mode: "url"`, a `message`, and include these additional parameters:
338338

339-
| Name | Type | Description |
340-
| --------------- | ------ | ----------------------------------------- |
341-
| `url` | string | The URL that the user should navigate to. |
342-
| `elicitationId` | string | A unique identifier for the elicitation. |
339+
| Name | Type | Default | Description |
340+
| ---------------------- | ------- | ------- | ------------------------------------------------------------------------------------------ |
341+
| `url` | string | - | The URL that the user should navigate to. |
342+
| `elicitationId` | string | - | A unique identifier for the elicitation. |
343+
| `notifiesOnCompletion` | boolean | false | Whether the server commits to sending a `notifications/elicitation/complete` notification. |
343344

344345
The `url` parameter **MUST** contain a valid URL. The `message` parameter **MUST NOT** contain a URL.
345346

347+
The `notifiesOnCompletion` parameter indicates whether the server commits to sending a `notifications/elicitation/complete` notification:
348+
349+
- When `notifiesOnCompletion` is `true`: The server **MUST** send the notification once it determines the out-of-band interaction has completed (whether successfully or not).
350+
- When `notifiesOnCompletion` is `false` or absent: Servers **SHOULD NOT** send the notification, and clients **MUST NOT** rely on receiving it.
351+
346352
#### Example: Request Sensitive Data
347353

348354
This example shows a URL mode elicitation request directing the user to a secure URL where they can provide sensitive information (an API key, for example).
@@ -359,7 +365,8 @@ The same request could direct the user into an OAuth authorization flow, or a pa
359365
"mode": "url",
360366
"elicitationId": "550e8400-e29b-41d4-a716-446655440000",
361367
"url": "https://mcp.example.com/ui/set_api_key",
362-
"message": "Please provide your API key to continue."
368+
"message": "Please provide your API key to continue.",
369+
"notifiesOnCompletion": true
363370
}
364371
}
365372
```
@@ -382,18 +389,32 @@ of band and the client is not aware of the outcome until and unless the server s
382389

383390
### Completion Notifications for URL Mode Elicitation
384391

385-
Servers **SHOULD** send a `notifications/elicitation/complete` notification when an
392+
Servers can send a `notifications/elicitation/complete` notification when an
386393
out-of-band interaction started by URL mode elicitation is completed. This allows clients to react programmatically if appropriate.
387394

388-
- The notification **MUST** only be sent to the client that initiated the elicitation request.
389-
- The notification **MUST** include the `elicitationId` established in the original
390-
`elicitation/create` request.
391-
- Clients **MUST** ignore notifications referencing unknown or already-completed IDs.
392-
- If a completion notification never arrives, clients **SHOULD** provide a manual
393-
way for the user to continue the interaction.
395+
Servers sending notifications:
396+
397+
- **MUST** only send the notification to the client that initiated the elicitation request.
398+
- **MUST** include the `elicitationId` established in the original `elicitation/create` request.
399+
400+
Clients receiving notifications:
401+
402+
- **MUST** ignore notifications referencing unknown or already-completed IDs.
403+
404+
The `notifiesOnCompletion` parameter in the `elicitation/create` request indicates whether the server commits to sending a `notifications/elicitation/complete` notification,
405+
and whether the client can expect to receive it.
406+
407+
When a server includes `notifiesOnCompletion: true` in an `elicitation/create` request:
408+
409+
- The server **MUST** send a `notifications/elicitation/complete` notification once it determines the out-of-band interaction has completed (whether successfully or not).
410+
- Clients **MAY** wait for this notification to automatically retry requests that received a [URLElicitationRequiredError](#error-handling), update the user interface, or otherwise continue an interaction.
411+
- Clients **SHOULD** still provide manual controls that let the user retry or cancel the original request (or otherwise resume interacting with the client) if the notification never arrives.
412+
413+
When a server includes `notifiesOnCompletion: false` in an `elicitation/create` request:
394414

395-
Clients **MAY** use the notification to automatically retry requests that received a [URLElicitationRequiredError](#error-handling), update the user interface, or otherwise continue an interaction.
396-
However, because delivery of the notification is not guaranteed, clients must not wait indefinitely for a notification from the server.
415+
- The server **SHOULD NOT** send a `notifications/elicitation/complete` notification.
416+
- Clients **MUST NOT** rely on receiving a notification.
417+
- Clients **SHOULD** provide a manual way for the user to continue the interaction.
397418

398419
#### Example
399420

@@ -430,7 +451,8 @@ Any elicitations returned in the error **MUST** be URL mode elicitations and hav
430451
"mode": "url",
431452
"elicitationId": "550e8400-e29b-41d4-a716-446655440000",
432453
"url": "https://mcp.example.com/connect?elicitationId=550e8400-e29b-41d4-a716-446655440000",
433-
"message": "Authorization is required to access your Example Co files."
454+
"message": "Authorization is required to access your Example Co files.",
455+
"notifiesOnCompletion": true
434456
}
435457
]
436458
}
@@ -480,7 +502,7 @@ sequenceDiagram
480502
481503
Note over User,UserAgent: User interaction
482504
UserAgent-->>Server: Interaction complete
483-
Server-->>Client: notifications/elicitation/complete (optional)
505+
Server-->>Client: notifications/elicitation/complete (if `notifiesOnCompletion: true`)
484506
485507
Note over Server: Continue processing with new information
486508
```
@@ -509,7 +531,7 @@ sequenceDiagram
509531
Note over User,UserAgent: User interaction
510532
511533
UserAgent-->>Server: Interaction complete
512-
Server-->>Client: notifications/elicitation/complete (optional)
534+
Server-->>Client: notifications/elicitation/complete (if `notifiesOnCompletion: true`)
513535
514536
Client->>Server: Retry tools/call (optional)
515537
```
@@ -651,7 +673,7 @@ sequenceDiagram
651673
Client->>Server: tools/call
652674
Note over Server: Needs 3rd-party authorization for user
653675
Note over Server: Store state (bind the elicitation request to the user)
654-
Server->>Client: URLElicitationRequiredError<br> (mode: "url", url: "https://mcp.example.com/connect?...")
676+
Server->>Client: URLElicitationRequiredError<br> (mode: "url", url: "https://mcp.example.com/connect?...", notifiesOnCompletion: true)
655677
Note over Client: Client notes the tools/call request can be retried later
656678
Client->>User: Present consent to open URL
657679
User->>Client: Provide consent
@@ -668,7 +690,7 @@ sequenceDiagram
668690
Server->>3AS: Exchange authorization code for OAuth tokens
669691
3AS->>Server: Grants tokens
670692
Note over Server: Bind tokens to MCP user identity
671-
Server-->>Client: notifications/elicitation/complete (optional)
693+
Server-->>Client: notifications/elicitation/complete
672694
Client->>Server: Retry tools/call
673695
Note over Server: Retrieve token bound to user identity
674696
Server->>3RS: Call 3rd-party API

0 commit comments

Comments
 (0)