Interface 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.
public interface IMcpElicitation
Remarks
Each method maps to a single-field MCP elicitation request. Returns null when the
client does not support elicitation or the user cancels the request.
Future: Multi-field elicitation (e.g., a form with several inputs at once) may be added via a builder pattern or a richer interface. If you need this capability, please open a feature request on the Repl repository.
Properties
IsSupported
Gets a value indicating whether the connected MCP client supports elicitation.
bool IsSupported { get; }
Property Value
Methods
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
messagestringThe prompt message shown to the user.
cancellationTokenCancellationTokenCancellation token.
Returns
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
messagestringThe prompt message shown to the user.
choicesIReadOnlyList<string>The available options.
cancellationTokenCancellationTokenCancellation token.
Returns
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
messagestringThe prompt message shown to the user.
cancellationTokenCancellationTokenCancellation token.
Returns
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
messagestringThe prompt message shown to the user.
cancellationTokenCancellationTokenCancellation token.