-
Notifications
You must be signed in to change notification settings - Fork 676
Expand file tree
/
Copy pathNotificationMethods.cs
More file actions
181 lines (169 loc) · 8.69 KB
/
NotificationMethods.cs
File metadata and controls
181 lines (169 loc) · 8.69 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
namespace ModelContextProtocol.Protocol;
/// <summary>
/// Provides constants with the names of common notification methods used in the MCP protocol.
/// </summary>
public static class NotificationMethods
{
/// <summary>
/// The name of the notification sent by a server when the list of available tools changes.
/// </summary>
/// <remarks>
/// This notification informs clients that the set of available tools has been modified.
/// Changes may include tools being added, removed, or updated. Upon receiving this
/// notification, clients may refresh their tool list by calling the appropriate
/// method to get the updated list of tools.
/// </remarks>
public const string ToolListChangedNotification = "notifications/tools/list_changed";
/// <summary>
/// The name of the notification sent by the server when the list of available prompts changes.
/// </summary>
/// <remarks>
/// This notification informs clients that the set of available prompts has been modified.
/// Changes may include prompts being added, removed, or updated. Upon receiving this
/// notification, clients may refresh their prompt list by calling the appropriate
/// method to get the updated list of prompts.
/// </remarks>
public const string PromptListChangedNotification = "notifications/prompts/list_changed";
/// <summary>
/// The name of the notification sent by the server when the list of available resources changes.
/// </summary>
/// <remarks>
/// This notification informs clients that the set of available resources has been modified.
/// Changes may include resources being added, removed, or updated. Upon receiving this
/// notification, clients may refresh their resource list by calling the appropriate
/// method to get the updated list of resources.
/// </remarks>
public const string ResourceListChangedNotification = "notifications/resources/list_changed";
/// <summary>
/// The name of the notification sent by the server when a resource is updated.
/// </summary>
/// <remarks>
/// This notification is used to inform clients about changes to a specific resource they have subscribed to.
/// When a resource is updated, the server sends this notification to all clients that have subscribed to that resource.
/// </remarks>
public const string ResourceUpdatedNotification = "notifications/resources/updated";
/// <summary>
/// The name of the notification sent by the client when roots have been updated.
/// </summary>
/// <remarks>
/// <para>
/// This notification informs the server that the client's "roots" have changed.
/// Roots inform servers about the directories and files the client considers relevant,
/// so that servers can focus their operations accordingly. They are informational guidance
/// rather than an access-control mechanism; the protocol does not enforce that servers stay within roots.
/// Servers can request the list of roots from supporting clients and receive notifications when that list changes.
/// </para>
/// <para>
/// After receiving this notification, servers can refresh their knowledge of roots by calling the appropriate
/// method to get the updated list of roots from the client.
/// </para>
/// </remarks>
public const string RootsListChangedNotification = "notifications/roots/list_changed";
/// <summary>
/// The name of the notification sent by the server when a log message is generated.
/// </summary>
/// <remarks>
/// <para>
/// This notification is used by the server to send log messages to clients. Log messages can include
/// different severity levels, such as debug, info, warning, or error, and an optional logger name to
/// identify the source component.
/// </para>
/// <para>
/// The minimum logging level that triggers notifications can be controlled by clients using the
/// <see cref="RequestMethods.LoggingSetLevel"/> request. If no level has been set by a client,
/// the server can determine which messages to send based on its own configuration.
/// </para>
/// </remarks>
public const string LoggingMessageNotification = "notifications/message";
/// <summary>
/// The name of the notification sent by the server when a URL-mode elicitation flow completes.
/// </summary>
/// <remarks>
/// This notification references the original elicitation by ID, allowing clients to retry blocked requests
/// or update their UI state once the out-of-band interaction finishes.
/// </remarks>
public const string ElicitationCompleteNotification = "notifications/elicitation/complete";
/// <summary>
/// The name of the notification sent from the client to the server after initialization has finished.
/// </summary>
/// <remarks>
/// <para>
/// This notification is sent by the client after it has received and processed the server's response to the
/// <see cref="RequestMethods.Initialize"/> request. It signals that the client is ready to begin normal operation
/// and that the initialization phase is complete.
/// </para>
/// <para>
/// After receiving this notification, the server can begin sending notifications and processing
/// further requests from the client.
/// </para>
/// </remarks>
public const string InitializedNotification = "notifications/initialized";
/// <summary>
/// The name of the notification sent to inform the receiver of a progress update for a long-running request.
/// </summary>
/// <remarks>
/// <para>
/// This notification provides updates on the progress of long-running operations. It includes
/// a progress token that associates the notification with a specific request, the current progress value,
/// and optionally, a total value and a descriptive message.
/// </para>
/// <para>
/// Progress notifications can be sent by either the client or the server, depending on the context.
/// Progress notifications enable clients to display progress indicators for operations that might take
/// significant time to complete, such as large file uploads, complex computations, or resource-intensive
/// processing tasks.
/// </para>
/// </remarks>
public const string ProgressNotification = "notifications/progress";
/// <summary>
/// The name of the notification sent to indicate that a previously issued request should be canceled.
/// </summary>
/// <remarks>
/// <para>
/// From the issuer's perspective, the request should still be in-flight. However, due to communication latency,
/// it is always possible that this notification might arrive after the request has already finished.
/// </para>
/// <para>
/// This notification indicates that the result will be unused, so any associated processing SHOULD cease.
/// </para>
/// <para>
/// A client must not attempt to cancel its `initialize` request.
/// </para>
/// </remarks>
public const string CancelledNotification = "notifications/cancelled";
/// <summary>
/// The name of the notification sent when a task status changes.
/// </summary>
/// <remarks>
/// <para>
/// When a task status changes, receivers may send this notification to inform the requestor
/// of the change. This notification includes the full task state.
/// </para>
/// <para>
/// Requestors must not rely on receiving this notification, as it is optional. Receivers
/// are not required to send status notifications and may choose to only send them for
/// certain status transitions. Requestors should continue to poll via tasks/get to ensure
/// they receive status updates.
/// </para>
/// </remarks>
public const string TaskStatusNotification = "notifications/tasks/status";
/// <summary>
/// The metadata key used to associate requests, responses, and notifications with a task.
/// </summary>
/// <remarks>
/// <para>
/// This constant defines the key <c>"io.modelcontextprotocol/related-task"</c> used in the
/// <c>_meta</c> field to associate messages with their originating task across the entire
/// request lifecycle.
/// </para>
/// <para>
/// For example, an elicitation that a task-augmented tool call depends on must share the
/// same related task ID with that tool call's task.
/// </para>
/// <para>
/// For <c>tasks/get</c>, <c>tasks/list</c>, and <c>tasks/cancel</c> operations, this
/// metadata should not be included as the taskId is already present in the message structure.
/// </para>
/// </remarks>
public const string RelatedTaskMetaKey = "io.modelcontextprotocol/related-task";
}