Skip to content

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

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)
  • message (string): The prompt message shown to the user.
  • cancellationToken (CancellationToken): Cancellation token.

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)
  • message (string): The prompt message shown to the user.
  • choices (IReadOnlyList<string>): The available options.
  • cancellationToken (CancellationToken): Cancellation token.

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)
  • message (string): The prompt message shown to the user.
  • cancellationToken (CancellationToken): Cancellation token.

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)
  • message (string): The prompt message shown to the user.
  • cancellationToken (CancellationToken): Cancellation token.

ValueTask<string>

Gets a value indicating whether the connected MCP client supports elicitation.

bool IsSupported { get; }

bool