Class ClientCapabilities
- Namespace
- ModelContextProtocol.Protocol
- Assembly
- ModelContextProtocol.Core.dll
Represents the capabilities that a client may support.
public class ClientCapabilities
- Inheritance
-
ClientCapabilities
- Inherited Members
Remarks
Capabilities define the features and functionality that a client can handle when communicating with an MCP server. These are advertised to the server during the initialize handshake.
See the schema for details.
Properties
Elicitation
Gets or sets the client's elicitation capability, which indicates whether the client supports elicitation of additional information from the user on behalf of the server.
[JsonPropertyName("elicitation")]
public ElicitationCapability? Elicitation { get; set; }
Property Value
Experimental
Gets or sets experimental, non-standard capabilities that the client supports.
[JsonPropertyName("experimental")]
public Dictionary<string, object>? Experimental { get; set; }
Property Value
Remarks
The Experimental dictionary allows clients to advertise support for features that are not yet standardized in the Model Context Protocol specification. This extension mechanism enables future protocol enhancements while maintaining backward compatibility.
Values in this dictionary are implementation-specific and should be coordinated between client and server implementations. Servers should not assume the presence of any experimental capability without checking for it first.
NotificationHandlers
Gets or sets notification handlers to register with the client.
[JsonIgnore]
public IEnumerable<KeyValuePair<string, Func<JsonRpcNotification, CancellationToken, ValueTask>>>? NotificationHandlers { get; set; }
Property Value
Remarks
When constructed, the client will enumerate these handlers once, which may contain multiple handlers per notification method key. The client will not re-enumerate the sequence after initialization.
Notification handlers allow the client to respond to server-sent notifications for specific methods. Each key in the collection is a notification method name, and each value is a callback that will be invoked when a notification with that method is received.
Handlers provided via NotificationHandlers will be registered with the client for the lifetime of the client. For transient handlers, RegisterNotificationHandler(string, Func<JsonRpcNotification, CancellationToken, ValueTask>) may be used to register a handler that can then be unregistered by disposing of the IAsyncDisposable returned from the method.
Roots
Gets or sets the client's roots capability, which are entry points for resource navigation.
[JsonPropertyName("roots")]
public RootsCapability? Roots { get; set; }
Property Value
Remarks
When Roots is non-null, the client indicates that it can respond to server requests for listing root URIs. Root URIs serve as entry points for resource navigation in the protocol.
The server can use RequestRootsAsync(IMcpServer, ListRootsRequestParams, CancellationToken) to request the list of available roots from the client, which will trigger the client's RootsHandler.
Sampling
Gets or sets the client's sampling capability, which indicates whether the client supports issuing requests to an LLM on behalf of the server.
[JsonPropertyName("sampling")]
public SamplingCapability? Sampling { get; set; }