using System.ComponentModel; using System.Diagnostics.CodeAnalysis; using System.Text.Json.Serialization; using ModelContextProtocol.Client; using ModelContextProtocol.Server; namespace ModelContextProtocol.Protocol; /// /// Represents the capabilities that a client supports. /// /// /// /// 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. /// /// public sealed class ClientCapabilities { /// /// Gets or sets experimental, non-standard capabilities that the client supports. /// /// /// /// The 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. /// /// [JsonPropertyName("experimental")] public IDictionary? Experimental { get; set; } /// /// Gets or sets the client's roots capability, which are entry points for resource navigation. /// /// /// /// When is non-, 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 to request the list of /// available roots from the client, which will trigger the client's . /// /// [JsonPropertyName("roots")] public RootsCapability? Roots { get; set; } /// /// 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; } /// /// 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; } /// /// Gets or sets optional MCP extensions that the client supports. /// /// /// /// Keys are extension identifiers in reverse domain notation with an extension name /// (e.g., "io.modelcontextprotocol/oauth-client-credentials"), and values are /// per-extension settings objects. An empty object indicates support with no additional settings. /// /// /// Extensions provide a framework for extending the Model Context Protocol while maintaining /// interoperability. Clients advertise extension support via this field during the initialization handshake. /// /// [Experimental(Experimentals.Extensions_DiagnosticId, UrlFormat = Experimentals.Extensions_Url)] [JsonIgnore] public IDictionary? Extensions { get => ExtensionsCore; set => ExtensionsCore = value; } // See ExperimentalInternalPropertyTests.cs before modifying this property. [JsonInclude] [JsonPropertyName("extensions")] internal IDictionary? ExtensionsCore { get; set; } }