forked from modelcontextprotocol/csharp-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInitializeRequestParams.cs
More file actions
61 lines (57 loc) · 2.61 KB
/
InitializeRequestParams.cs
File metadata and controls
61 lines (57 loc) · 2.61 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
using System.Text.Json.Serialization;
namespace ModelContextProtocol.Protocol;
/// <summary>
/// Represents the parameters used with a <see cref="RequestMethods.Initialize"/> request sent by a client to a server during the protocol handshake.
/// </summary>
/// <remarks>
/// <para>
/// The <see cref="InitializeRequestParams"/> is the first message sent in the Model Context Protocol
/// communication flow. It establishes the connection between client and server, negotiates the protocol
/// version, and declares the client's capabilities.
/// </para>
/// <para>
/// After sending this request, the client should wait for an <see cref="InitializeResult"/> response
/// before sending an <see cref="NotificationMethods.InitializedNotification"/> notification to complete the handshake.
/// </para>
/// <para>
/// See the <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">schema</see> for details.
/// </para>
/// </remarks>
public class InitializeRequestParams : RequestParams
{
/// <summary>
/// Gets or sets the version of the Model Context Protocol that the client wants to use.
/// </summary>
/// <remarks>
/// <para>
/// Protocol version is specified using a date-based versioning scheme in the format "YYYY-MM-DD".
/// The client and server must agree on a protocol version to communicate successfully.
/// </para>
/// <para>
/// During initialization, the server will check if it supports this requested version. If there's a
/// mismatch, the server will reject the connection with a version mismatch error.
/// </para>
/// <para>
/// See the <see href="https://spec.modelcontextprotocol.io/specification/">protocol specification</see> for version details.
/// </para>
/// </remarks>
[JsonPropertyName("protocolVersion")]
public required string ProtocolVersion { get; init; }
/// <summary>
/// Gets or sets the client's capabilities.
/// </summary>
/// <remarks>
/// Capabilities define the features the client supports, such as "sampling" or "roots".
/// </remarks>
[JsonPropertyName("capabilities")]
public ClientCapabilities? Capabilities { get; init; }
/// <summary>
/// Gets or sets information about the client implementation, including its name and version.
/// </summary>
/// <remarks>
/// This information is required during the initialization handshake to identify the client.
/// Servers may use this information for logging, debugging, or compatibility checks.
/// </remarks>
[JsonPropertyName("clientInfo")]
public required Implementation ClientInfo { get; init; }
}