IMcpElicitation
Provides direct access to MCP elicitation (structured user input) from the connected client. Inject this interface into command handlers to request user input outside the IReplInteractionChannel abstraction.
- Kind:
Interface - Namespace: Repl.Mcp
- Assembly:
Repl.Mcp - Source: src/Repl.Mcp/IMcpElicitation.cs
Signature
Section titled “Signature”public interface IMcpElicitationMethods
Section titled “Methods”ElicitBooleanAsync(string, CancellationToken)
Section titled “ElicitBooleanAsync(string, CancellationToken)”Asks the user for a boolean (yes/no) value.
Returns null when elicitation is not supported or the user cancels.
ValueTask<bool?> ElicitBooleanAsync(string message, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”message(string): The prompt message shown to the user.cancellationToken(CancellationToken): Cancellation token.
Returns
Section titled “Returns”ValueTask<bool?>
ElicitChoiceAsync(string, IReadOnlyList<string>, CancellationToken)
Section titled “ElicitChoiceAsync(string, IReadOnlyList<string>, CancellationToken)”Asks the user to pick one value from a list of choices.
Returns the zero-based index of the selected choice, or null when elicitation
is not supported, the user cancels, or the response does not match any choice.
ValueTask<int?> ElicitChoiceAsync(string message, IReadOnlyList<string> choices, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”message(string): The prompt message shown to the user.choices(IReadOnlyList<string>): The available options.cancellationToken(CancellationToken): Cancellation token.
Returns
Section titled “Returns”ValueTask<int?>
ElicitNumberAsync(string, CancellationToken)
Section titled “ElicitNumberAsync(string, CancellationToken)”Asks the user for a numeric value.
Returns null when elicitation is not supported or the user cancels.
ValueTask<double?> ElicitNumberAsync(string message, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”message(string): The prompt message shown to the user.cancellationToken(CancellationToken): Cancellation token.
Returns
Section titled “Returns”ValueTask<double?>
ElicitTextAsync(string, CancellationToken)
Section titled “ElicitTextAsync(string, CancellationToken)”Asks the user for a free-text value.
Returns null when elicitation is not supported or the user cancels.
ValueTask<string?> ElicitTextAsync(string message, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”message(string): The prompt message shown to the user.cancellationToken(CancellationToken): Cancellation token.
Returns
Section titled “Returns”ValueTask<string>
Properties
Section titled “Properties”IsSupported
Section titled “IsSupported”Gets a value indicating whether the connected MCP client supports elicitation.
bool IsSupported { get; }