forked from modelcontextprotocol/csharp-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClientCapabilities.cs
More file actions
99 lines (92 loc) · 4.42 KB
/
Copy pathClientCapabilities.cs
File metadata and controls
99 lines (92 loc) · 4.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
using System.Text.Json;
using System.Text.Json.Serialization;
using ModelContextProtocol.Client;
using ModelContextProtocol.Server;
namespace ModelContextProtocol.Protocol;
/// <summary>
/// Represents the capabilities that a client supports.
/// </summary>
/// <remarks>
/// <para>
/// 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.
/// </para>
/// <para>
/// See the <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">schema</see> for details.
/// </para>
/// </remarks>
public sealed class ClientCapabilities
{
/// <summary>
/// Gets or sets experimental, non-standard capabilities that the client supports.
/// </summary>
/// <remarks>
/// <para>
/// The <see cref="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.
/// </para>
/// <para>
/// 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.
/// </para>
/// </remarks>
[JsonPropertyName("experimental")]
public IDictionary<string, object>? Experimental { get; set; }
/// <summary>
/// Gets or sets the client's roots capability, which are entry points for resource navigation.
/// </summary>
/// <remarks>
/// <para>
/// When <see cref="Roots"/> is non-<see langword="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.
/// </para>
/// <para>
/// The server can use <see cref="McpServer.RequestRootsAsync"/> to request the list of
/// available roots from the client, which will trigger the client's <see cref="McpClientHandlers.RootsHandler"/>.
/// </para>
/// </remarks>
[JsonPropertyName("roots")]
[Obsolete(Obsoletions.DeprecatedRoots_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
public RootsCapability? Roots { get; set; }
/// <summary>
/// Gets or sets the client's sampling capability, which indicates whether the client
/// supports issuing requests to an LLM on behalf of the server.
/// </summary>
[JsonPropertyName("sampling")]
[Obsolete(Obsoletions.DeprecatedSampling_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
public SamplingCapability? Sampling { get; set; }
/// <summary>
/// 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.
/// </summary>
[JsonPropertyName("elicitation")]
public ElicitationCapability? Elicitation { get; set; }
/// <summary>
/// Gets or sets optional MCP extensions that the client supports.
/// </summary>
/// <remarks>
/// <para>
/// Keys are extension identifiers in reverse domain notation with an extension name
/// (e.g., <c>"io.modelcontextprotocol/oauth-client-credentials"</c>), and values are
/// per-extension settings objects. An empty object indicates support with no additional settings.
/// </para>
/// <para>
/// Extensions provide a framework for extending the Model Context Protocol while maintaining
/// interoperability. Clients advertise extension support via this field during the initialization handshake.
/// </para>
/// </remarks>
[JsonPropertyName("extensions")]
public IDictionary<string, object>? Extensions { get; set; }
/// <summary>
/// Gets or sets unrecognized capability properties for protocol extensions that define
/// top-level capability names.
/// </summary>
/// <remarks>
/// Extension packages should prefer <see cref="Extensions"/> when the negotiated protocol
/// supports it. This property preserves capability names defined by historical protocol revisions.
/// </remarks>
[JsonExtensionData]
public IDictionary<string, JsonElement>? AdditionalProperties { get; set; }
}