Class SamplingCapability
- Namespace
- ModelContextProtocol.Protocol
- Assembly
- ModelContextProtocol.Core.dll
Represents the capability for a client to generate text or other content using an AI model.
[Obsolete("The Sampling feature is deprecated as of specification version 2026-07-28 and may be removed in a future version. See SEP-2577 for more information.", DiagnosticId = "MCP9005", UrlFormat = "https://github.com/modelcontextprotocol/csharp-sdk/blob/main/docs/list-of-diagnostics.md#obsolete-apis")]
public sealed class SamplingCapability
- Inheritance
-
SamplingCapability
- Inherited Members
Remarks
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 SamplingHandler to process these requests.
Properties
Context
Gets or sets whether the client supports context inclusion via includeContext parameter.
[JsonPropertyName("context")]
public SamplingContextCapability? Context { get; set; }
Property Value
Remarks
If not declared, servers should only use includeContext: "none".
Tools
Gets or sets whether the client supports tool use via tools and toolChoice parameters.
[JsonPropertyName("tools")]
public SamplingToolsCapability? Tools { get; set; }