Skip to content

Commit 2eb608e

Browse files
authored
Merge pull request modelcontextprotocol#382 from siwachabhi/feature/elicitation
[feat] Introduce elcitation as new client capability
2 parents 3046cd5 + 7973335 commit 2eb608e

File tree

7 files changed

+637
-7
lines changed

7 files changed

+637
-7
lines changed

docs/docs.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@
203203
"group": "Client Features",
204204
"pages": [
205205
"specification/draft/client/roots",
206-
"specification/draft/client/sampling"
206+
"specification/draft/client/sampling",
207+
"specification/draft/client/elicitation"
207208
]
208209
},
209210
{

docs/specification/draft/basic/lifecycle.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ The client **MUST** initiate this phase by sending an `initialize` request conta
6161
"roots": {
6262
"listChanged": true
6363
},
64-
"sampling": {}
64+
"sampling": {},
65+
"elicitation": {}
6566
},
6667
"clientInfo": {
6768
"name": "ExampleClient",
@@ -148,6 +149,7 @@ Key capabilities include:
148149
| -------- | -------------- | -------------------------------------------------------------------------- |
149150
| Client | `roots` | Ability to provide filesystem [roots](/specification/draft/client/roots) |
150151
| Client | `sampling` | Support for LLM [sampling](/specification/draft/client/sampling) requests |
152+
| Client | `elicitation` | Support for server [elicitation](/specification/draft/client/elicitation) requests |
151153
| Client | `experimental` | Describes support for non-standard experimental features |
152154
| Server | `prompts` | Offers [prompt templates](/specification/draft/server/prompts) |
153155
| Server | `resources` | Provides readable [resources](/specification/draft/server/resources) |

docs/specification/draft/changelog.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ the previous revision, [2025-03-26](/specification/2025-03-26).
1313
(PR [#371](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/371))
1414
3. Classified MCP servers as [OAuth Resource Servers](https://modelcontextprotocol.io/specification/draft/basic/authorization#2-3-authorization-server-discovery), adding protected resource metadata to discover the corresponding Authorization server. (PR [#338](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/338))
1515
4. Clarified [security considerations](https://modelcontextprotocol.io/specification/draft/basic/authorization#3-security-considerations) and best practices in the authorization spec and in a new [security best practices page](https://modelcontextprotocol.io/specification/draft/basic/security_best_practices).
16+
5. Added support for **[elicitation](/specification/draft/client/elicitation)**, enabling
17+
servers to request additional information from users during interactions. (PR [#382](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/382))
1618

1719
## Other schema changes
1820

19-
- TODO
20-
2121
## Full changelog
2222

2323
For a complete list of all changes that have been made since the last protocol revision,
Lines changed: 314 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,314 @@
1+
---
2+
title: Elicitation
3+
---
4+
5+
<Info>**Protocol Revision**: draft</Info>
6+
7+
The Model Context Protocol (MCP) provides a standardized way for servers to request additional
8+
information from users through the client during interactions. This flow allows clients to
9+
maintain control over user interactions and data sharing while enabling servers to gather
10+
necessary information dynamically.
11+
Servers can request structured data from users with optional JSON schemas to validate responses.
12+
13+
## User Interaction Model
14+
15+
Elicitation in MCP allows servers to implement interactive workflows by enabling user input
16+
requests to occur _nested_ inside other MCP server features.
17+
18+
Implementations are free to expose elicitation through any interface pattern that suits
19+
their needs&mdash;the protocol itself does not mandate any specific user interaction
20+
model.
21+
22+
<Warning>
23+
For trust & safety and security:
24+
25+
- Servers **MUST NOT** use elicitation to request sensitive information.
26+
27+
Applications **SHOULD**:
28+
29+
- Provide UI that makes it clear which server is requesting information
30+
- Allow users to review and modify their responses before sending
31+
- Respect user privacy and provide clear decline and cancel options
32+
</Warning>
33+
34+
## Capabilities
35+
36+
Clients that support elicitation **MUST** declare the `elicitation` capability during
37+
[initialization](/specification/draft/basic/lifecycle#initialization):
38+
39+
```json
40+
{
41+
"capabilities": {
42+
"elicitation": {}
43+
}
44+
}
45+
```
46+
47+
## Protocol Messages
48+
49+
### Creating Elicitation Requests
50+
51+
To request information from a user, servers send an `elicitation/create` request:
52+
53+
#### Simple Text Request
54+
55+
**Request:**
56+
57+
```json
58+
{
59+
"jsonrpc": "2.0",
60+
"id": 1,
61+
"method": "elicitation/create",
62+
"params": {
63+
"message": "Please provide your GitHub username",
64+
"requestedSchema": {
65+
"type": "object",
66+
"properties": {
67+
"name": {
68+
"type": "string",
69+
},
70+
},
71+
"required": ["name"]
72+
}
73+
}
74+
}
75+
```
76+
77+
**Response:**
78+
79+
```json
80+
{
81+
"jsonrpc": "2.0",
82+
"id": 1,
83+
"result": {
84+
"action": "accept",
85+
"content": {
86+
"name": "octocat"
87+
}
88+
}
89+
}
90+
```
91+
92+
#### Structured Data Request
93+
94+
**Request:**
95+
96+
```json
97+
{
98+
"jsonrpc": "2.0",
99+
"id": 2,
100+
"method": "elicitation/create",
101+
"params": {
102+
"message": "Please provide your contact information",
103+
"requestedSchema": {
104+
"type": "object",
105+
"properties": {
106+
"name": {
107+
"type": "string",
108+
"description": "Your full name"
109+
},
110+
"email": {
111+
"type": "string",
112+
"format": "email",
113+
"description": "Your email address"
114+
},
115+
"age": {
116+
"type": "number",
117+
"minimum": 18,
118+
"description": "Your age"
119+
}
120+
},
121+
"required": ["name", "email"]
122+
}
123+
}
124+
}
125+
```
126+
127+
**Response:**
128+
129+
```json
130+
{
131+
"jsonrpc": "2.0",
132+
"id": 2,
133+
"result": {
134+
"action": "accept",
135+
"content": {
136+
"name": "Monalisa Octocat",
137+
"email": "[email protected]",
138+
"age": 30
139+
}
140+
}
141+
}
142+
```
143+
144+
**Decline Response Example:**
145+
146+
```json
147+
{
148+
"jsonrpc": "2.0",
149+
"id": 2,
150+
"result": {
151+
"action": "decline"
152+
}
153+
}
154+
```
155+
156+
**Cancel Response Example:**
157+
158+
```json
159+
{
160+
"jsonrpc": "2.0",
161+
"id": 2,
162+
"result": {
163+
"action": "cancel"
164+
}
165+
}
166+
```
167+
168+
## Message Flow
169+
170+
```mermaid
171+
sequenceDiagram
172+
participant Server
173+
participant Client
174+
participant User
175+
176+
Note over Server,Client: Server initiates elicitation
177+
Server->>Client: elicitation/create
178+
179+
Note over Client,User: Human interaction
180+
Client->>User: Present elicitation UI
181+
User-->>Client: Provide requested information
182+
183+
Note over Server,Client: Complete request
184+
Client-->>Server: Return user response
185+
186+
Note over Server: Continue processing with new information
187+
```
188+
189+
## Request Schema
190+
191+
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:
192+
193+
```json
194+
"requestedSchema": {
195+
"type": "object",
196+
"properties": {
197+
"propertyName": {
198+
"type": "string",
199+
"title": "Display Name",
200+
"description": "Description of the property"
201+
},
202+
"anotherProperty": {
203+
"type": "number",
204+
"minimum": 0,
205+
"maximum": 100
206+
}
207+
},
208+
"required": ["propertyName"]
209+
}
210+
```
211+
212+
### Supported Schema Types
213+
214+
The schema is restricted to these primitive types:
215+
216+
1. **String Schema**
217+
```json
218+
{
219+
"type": "string",
220+
"title": "Display Name",
221+
"description": "Description text",
222+
"minLength": 3,
223+
"maxLength": 50,
224+
"pattern": "^[A-Za-z]+$",
225+
"format": "email"
226+
}
227+
```
228+
Supported formats: `email`, `uri`, `date`, `date-time`
229+
230+
2. **Number Schema**
231+
```json
232+
{
233+
"type": "number", // or "integer"
234+
"title": "Display Name",
235+
"description": "Description text",
236+
"minimum": 0,
237+
"maximum": 100
238+
}
239+
```
240+
241+
3. **Boolean Schema**
242+
```json
243+
{
244+
"type": "boolean",
245+
"title": "Display Name",
246+
"description": "Description text",
247+
"default": false
248+
}
249+
```
250+
251+
4. **Enum Schema**
252+
```json
253+
{
254+
"type": "string",
255+
"title": "Display Name",
256+
"description": "Description text",
257+
"enum": ["option1", "option2", "option3"],
258+
"enumNames": ["Option 1", "Option 2", "Option 3"]
259+
}
260+
```
261+
262+
Clients can use this schema to:
263+
1. Generate appropriate input forms
264+
2. Validate user input before sending
265+
3. Provide better guidance to users
266+
267+
Note that complex nested structures, arrays of objects, and other advanced JSON Schema features are intentionally not supported to simplify client implementation.
268+
269+
## Response Actions
270+
271+
Elicitation responses use a three-action model to clearly distinguish between different user actions:
272+
273+
```json
274+
{
275+
"jsonrpc": "2.0",
276+
"id": 1,
277+
"result": {
278+
"action": "accept", // or "decline" or "cancel"
279+
"content": {
280+
"propertyName": "value",
281+
"anotherProperty": 42
282+
}
283+
}
284+
}
285+
```
286+
287+
The three response actions are:
288+
289+
1. **Accept** (`action: "accept"`): User explicitly approved and submitted with data
290+
- The `content` field contains the submitted data matching the requested schema
291+
- Example: User clicked "Submit", "OK", "Confirm", etc.
292+
293+
2. **Decline** (`action: "decline"`): User explicitly rejected the request
294+
- The `content` field is typically omitted
295+
- Example: User clicked "Decline", "Reject", "No", etc.
296+
297+
3. **Cancel** (`action: "cancel"`): User dismissed without making an explicit choice
298+
- The `content` field is typically omitted
299+
- Example: User closed the dialog, clicked outside, pressed Escape, etc.
300+
301+
Servers should handle each state appropriately:
302+
- **Accept**: Process the submitted data
303+
- **Decline**: Handle explicit rejection (e.g., offer alternatives)
304+
- **Cancel**: Handle dismissal (e.g., prompt again later)
305+
306+
## Security Considerations
307+
308+
1. Servers **MUST NOT** request sensitive information through elicitation
309+
2. Clients **SHOULD** implement user approval controls
310+
3. Both parties **SHOULD** validate elicitation content against the provided schema
311+
4. Clients **SHOULD** provide clear indication of which server is requesting information
312+
5. Clients **SHOULD** allow users to reject elicitation requests at any time
313+
6. Clients **SHOULD** implement rate limiting
314+
7. Clients **SHOULD** present elicitation requests in a way that makes it clear what information is being requested and why

docs/specification/draft/index.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,10 @@ Servers offer any of the following features to clients:
5959
- **Prompts**: Templated messages and workflows for users
6060
- **Tools**: Functions for the AI model to execute
6161

62-
Clients may offer the following feature to servers:
62+
Clients may offer the following features to servers:
6363

6464
- **Sampling**: Server-initiated agentic behaviors and recursive LLM interactions
65+
- **Elicitation**: Server-initiated requests for additional information from users
6566

6667
### Additional Utilities
6768

0 commit comments

Comments
 (0)