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
# Ignore external links that result in 403 errors during CI. Do not warn for redirects where we want to keep the vanity URL in the markdown or for GitHub links that redirect to the login.
# Ignore external links that result in 403 errors during CI. Do not warn for redirects where we want to keep the vanity URL in the markdown or for GitHub links that redirect to the login, and DocFX snippet links.
description: Enable interactive AI experiences by requesting user input during tool execution.
5
+
uid: elicitation
6
+
---
7
+
8
+
## Elicitation
9
+
10
+
The **elicitation** feature allows servers to request additional information from users during interactions. This enables more dynamic and interactive AI experiences, making it easier to gather necessary context before executing tasks.
11
+
12
+
### Server Support for Elicitation
13
+
14
+
Servers request structured data from users with the [ElicitAsync] extension method on [IMcpServer].
15
+
The C# SDK registers an instance of [IMcpServer] with the dependency injection container,
16
+
so tools can simply add a parameter of type [IMcpServer] to their method signature to access it.
Elicitation is an optional feature so clients declare their support for it in their capabilities as part of the `initialize` request. In the MCP C# SDK, this is done by configuring an [ElicitationHandler] in the [McpClientOptions]:
The ElicitationHandler is an asynchronous method that will be called when the server requests additional information.
42
+
The ElicitationHandler must request input from the user and return the data in a format that matches the requested schema.
43
+
This will be highly dependent on the client application and how it interacts with the user.
44
+
45
+
If the user provides the requested information, the ElicitationHandler should return an [ElicitResult] with the action set to "accept" and the content containing the user's input.
46
+
If the user does not provide the requested information, the ElicitationHandler should return an [ElicitResult] with the action set to "reject" and no content.
0 commit comments