Skip to content

Add an ElicitAsync<T> overload #630

@stephentoub

Description

@stephentoub

Right now, we expose this overload for a server to elicit a user response:

public static ValueTask<ElicitResult> ElicitAsync(
this IMcpServer server, ElicitRequestParams request, CancellationToken cancellationToken = default)

public static ValueTask<ElicitResult> ElicitAsync(
        this IMcpServer server, ElicitRequestParams request, CancellationToken cancellationToken = default)

We could smooth this over with another overload something like:

public static ValueTask<ElicitResult<T?>> ElicitAsync<T>(
        this IMcpServer server, string message, JsonSerializerOptions? serializerOptions = null, CancellationToken cancellationToken = default) where T : class

where we use the T to create the request schema and then automatically deserialize the response if the user supplied the requested data.

(Elicitation, however, employs a very constrained subset of JSON schema, so this would only work with a subset of Ts.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions