using Microsoft.Extensions.AI;
using ModelContextProtocol.Client;
using System.Text.Json.Serialization;
namespace ModelContextProtocol.Protocol;
///
/// Represents the capability for a client to generate text or other content using an AI model.
///
///
///
/// This capability enables the MCP client to respond to sampling requests from an MCP server.
///
///
/// When this capability is enabled, an MCP server can request the client to generate content
/// using an AI model. The client must set a to process these requests.
///
///
public sealed class SamplingCapability
{
// Currently empty in the spec, but may be extended in the future
///
/// Gets or sets the handler for processing requests.
///
///
///
/// This handler function is called when an MCP server requests the client to generate content
/// using an AI model. The client must set this property for the sampling capability to work.
///
///
/// The handler receives message parameters, a progress reporter for updates, and a
/// cancellation token. It should return a containing the
/// generated content.
///
///
/// You can create a handler using the extension
/// method with any implementation of .
///
///
[JsonIgnore]
public Func, CancellationToken, ValueTask>? SamplingHandler { get; set; }
}