forked from modelcontextprotocol/csharp-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRequestMethods.cs
More file actions
165 lines (147 loc) · 8.03 KB
/
Copy pathRequestMethods.cs
File metadata and controls
165 lines (147 loc) · 8.03 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
namespace ModelContextProtocol.Protocol;
/// <summary>
/// Provides constants with the names of common request methods used in the MCP protocol.
/// </summary>
public static class RequestMethods
{
/// <summary>
/// The name of the request method sent from the client to request a list of the server's tools.
/// </summary>
public const string ToolsList = "tools/list";
/// <summary>
/// The name of the request method sent from the client to request that the server invoke a specific tool.
/// </summary>
public const string ToolsCall = "tools/call";
/// <summary>
/// The name of the request method sent from the client to request a list of the server's prompts.
/// </summary>
public const string PromptsList = "prompts/list";
/// <summary>
/// The name of the request method sent by the client to get a prompt provided by the server.
/// </summary>
public const string PromptsGet = "prompts/get";
/// <summary>
/// The name of the request method sent from the client to request a list of the server's resources.
/// </summary>
public const string ResourcesList = "resources/list";
/// <summary>
/// The name of the request method sent from the client to read a specific server resource.
/// </summary>
public const string ResourcesRead = "resources/read";
/// <summary>
/// The name of the request method sent from the client to request a list of the server's resource templates.
/// </summary>
public const string ResourcesTemplatesList = "resources/templates/list";
/// <summary>
/// The name of the request method sent from the client to request <see cref="NotificationMethods.ResourceUpdatedNotification"/>
/// notifications from the server whenever a particular resource changes.
/// </summary>
public const string ResourcesSubscribe = "resources/subscribe";
/// <summary>
/// The name of the request method sent from the client to request unsubscribing from <see cref="NotificationMethods.ResourceUpdatedNotification"/>
/// notifications from the server.
/// </summary>
public const string ResourcesUnsubscribe = "resources/unsubscribe";
/// <summary>
/// The name of the request method sent from the server to request a list of the client's roots.
/// </summary>
[Obsolete(Obsoletions.DeprecatedRoots_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
public const string RootsList = "roots/list";
/// <summary>
/// The name of the request method sent by either endpoint to check that the connected endpoint is still alive.
/// </summary>
public const string Ping = "ping";
/// <summary>
/// The name of the request method sent from the client to the server to adjust the logging level.
/// </summary>
/// <remarks>
/// This request allows clients to control which log messages they receive from the server
/// by setting a minimum severity threshold. After processing this request, the server will
/// send log messages with severity at or above the specified level to the client as
/// <see cref="NotificationMethods.LoggingMessageNotification"/> notifications.
/// </remarks>
[Obsolete(Obsoletions.DeprecatedLogging_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
public const string LoggingSetLevel = "logging/setLevel";
/// <summary>
/// The name of the request method sent from the client to the server to ask for completion suggestions.
/// </summary>
/// <remarks>
/// This is used to provide autocompletion-like functionality for arguments in a resource reference or a prompt template.
/// The client provides a reference (resource or prompt), argument name, and partial value, and the server
/// responds with matching completion options.
/// </remarks>
public const string CompletionComplete = "completion/complete";
/// <summary>
/// The name of the request method sent from the server to sample a large language model (LLM) via the client.
/// </summary>
/// <remarks>
/// This request allows servers to utilize an LLM available on the client side to generate text or image responses
/// based on provided messages. It is part of the sampling capability in the Model Context Protocol and enables servers to access
/// client-side AI models without needing direct API access to those models.
/// </remarks>
[Obsolete(Obsoletions.DeprecatedSampling_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)]
public const string SamplingCreateMessage = "sampling/createMessage";
/// <summary>
/// The name of the request method sent from the server to elicit additional information from the user via the client.
/// </summary>
/// <remarks>
/// <para>
/// This request is used when the server needs more information from the client to proceed with a task or interaction.
/// Servers can request structured data from users, with optional JSON schemas to validate responses (form mode),
/// or request URL mode (out-of-band) user interaction via navigation for sensitive operations.
/// </para>
/// <para>
/// Two modes are supported:
/// <list type="bullet">
/// <item><description><b>form</b>: In-band elicitation where structured data is collected and returned to the server</description></item>
/// <item><description><b>url</b>: URL mode (out-of-band) elicitation for sensitive operations like OAuth or payments</description></item>
/// </list>
/// </para>
/// </remarks>
public const string ElicitationCreate = "elicitation/create";
/// <summary>
/// The name of the request method sent from the client to the server when it first connects, asking it to initialize.
/// </summary>
/// <remarks>
/// The initialize request is the first request sent by the client to the server. It provides client information
/// and capabilities to the server during connection establishment. The server responds with its own capabilities
/// and information, establishing the protocol version and available features for the session.
/// </remarks>
public const string Initialize = "initialize";
/// <summary>
/// The name of the request method sent from the client to discover the server's protocol versions,
/// capabilities, and metadata.
/// </summary>
/// <remarks>
/// <para>
/// This RPC is introduced in the 2026-07-28 protocol revision (SEP-2575) as the canonical way for a client
/// to learn what a server supports without performing the legacy <c>initialize</c> handshake.
/// </para>
/// <para>
/// The server's response includes its supported protocol versions, capabilities, implementation
/// information, and optional usage instructions.
/// </para>
/// <para>
/// Servers SHOULD implement this method. Legacy clients MAY ignore it. Clients on the 2026-07-28 revision
/// typically call this once during connection establishment.
/// </para>
/// </remarks>
public const string ServerDiscover = "server/discover";
/// <summary>
/// The name of the request method sent from the client to open a long-lived subscription for
/// receiving server-to-client notifications outside of a specific request's response stream.
/// </summary>
/// <remarks>
/// <para>
/// This RPC is introduced in the 2026-07-28 protocol revision (SEP-2575) and replaces the unsolicited
/// HTTP GET endpoint and the legacy <see cref="ResourcesSubscribe"/> / <see cref="ResourcesUnsubscribe"/>
/// request methods.
/// </para>
/// <para>
/// The request opens a response stream on which the server first sends a
/// <see cref="NotificationMethods.SubscriptionsAcknowledgedNotification"/> describing the granted
/// notifications, and then streams matching notifications until the subscription is cancelled.
/// </para>
/// </remarks>
public const string SubscriptionsListen = "subscriptions/listen";
}