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
MCP servers can request additional information from users through the elicitation feature. This is useful for interactive workflows where the server needs user input or confirmation:
1178
+
MCP servers can request non-sensitive information from users through the form elicitation capability. This is useful for interactive workflows where the server needs user input or confirmation:
1179
1179
1180
1180
```typescript
1181
1181
// Server-side: Restaurant booking tool that asks for alternatives
@@ -1208,6 +1208,7 @@ server.registerTool(
1208
1208
if (!available) {
1209
1209
// Ask user if they want to try alternative dates
1210
1210
const result =awaitserver.server.elicitInput({
1211
+
mode: 'form',
1211
1212
message: `No tables available at ${restaurant} on ${date}. Would you like to check alternative dates?`,
1212
1213
requestedSchema: {
1213
1214
type: 'object',
@@ -1274,7 +1275,7 @@ server.registerTool(
1274
1275
);
1275
1276
```
1276
1277
1277
-
Client-side: Handle elicitation requests
1278
+
On the client side, handle form elicitation requests:
1278
1279
1279
1280
```typescript
1280
1281
// This is a placeholder - implement based on your UI framework
**Note**: Elicitation requires client support. Clients must declare the `elicitation` capability during initialization.
1303
+
When calling `server.elicitInput`, prefer to explicitly set `mode: 'form'` for new code. Omitting the mode continues to work for backwards compatibility and defaults to form elicitation.
1304
+
1305
+
Elicitation is a client capability. Clients must declare the `elicitation` capability during initialization:
1306
+
1307
+
```typescript
1308
+
const client =newClient(
1309
+
{
1310
+
name: 'example-client',
1311
+
version: '1.0.0'
1312
+
},
1313
+
{
1314
+
capabilities: {
1315
+
elicitation: {
1316
+
form: {}
1317
+
}
1318
+
}
1319
+
}
1320
+
);
1321
+
```
1322
+
1323
+
**Note**: Form elicitation **must** only be used to gather non-sensitive information. For sensitive information such as API keys or secrets, use URL elicitation instead.
1324
+
1325
+
### Eliciting URL Actions
1326
+
1327
+
MCP servers can prompt the user to perform a URL-based action through URL elicitation. This is useful for securely gathering sensitive information such as API keys or secrets, or for redirecting users to secure web-based flows.
1328
+
1329
+
```typescript
1330
+
// Server-side: Prompt the user to navigate to a URL
0 commit comments