Skip to content

Commit faab35e

Browse files
Copilotstephentoub
andcommitted
Add missing McpException docs to GetTaskAsync, ListTasksAsync, CancelTaskAsync, and NotifyTaskStatusAsync
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
1 parent 2aa846c commit faab35e

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/ModelContextProtocol.Core/Client/McpClient.Methods.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,7 @@ async ValueTask<McpTask> SendTaskAugmentedCallToolRequestWithProgressAsync(
10361036
/// <returns>The current state of the task.</returns>
10371037
/// <exception cref="ArgumentNullException"><paramref name="taskId"/> is <see langword="null"/>.</exception>
10381038
/// <exception cref="ArgumentException"><paramref name="taskId"/> is empty or composed entirely of whitespace.</exception>
1039+
/// <exception cref="McpException">The request failed or the server returned an error response.</exception>
10391040
[Experimental(Experimentals.Tasks_DiagnosticId, UrlFormat = Experimentals.Tasks_Url)]
10401041
public async ValueTask<McpTask> GetTaskAsync(
10411042
string taskId,
@@ -1100,6 +1101,7 @@ public ValueTask<JsonElement> GetTaskResultAsync(
11001101
/// <param name="options">Optional request options including metadata, serialization settings, and progress tracking.</param>
11011102
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
11021103
/// <returns>A list of all tasks.</returns>
1104+
/// <exception cref="McpException">The request failed or the server returned an error response.</exception>
11031105
[Experimental(Experimentals.Tasks_DiagnosticId, UrlFormat = Experimentals.Tasks_Url)]
11041106
public async ValueTask<IList<McpTask>> ListTasksAsync(
11051107
RequestOptions? options = null,
@@ -1125,6 +1127,7 @@ public async ValueTask<IList<McpTask>> ListTasksAsync(
11251127
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
11261128
/// <returns>The result of the request as provided by the server.</returns>
11271129
/// <exception cref="ArgumentNullException"><paramref name="requestParams"/> is <see langword="null"/>.</exception>
1130+
/// <exception cref="McpException">The request failed or the server returned an error response.</exception>
11281131
/// <remarks>
11291132
/// The <see cref="ListTasksAsync(RequestOptions?, CancellationToken)"/> overload retrieves all tasks by automatically handling pagination.
11301133
/// This overload works with the lower-level <see cref="ListTasksRequestParams"/> and <see cref="ListTasksResult"/>, returning the raw result from the server.
@@ -1154,6 +1157,7 @@ public ValueTask<ListTasksResult> ListTasksAsync(
11541157
/// <returns>The updated state of the task after cancellation.</returns>
11551158
/// <exception cref="ArgumentNullException"><paramref name="taskId"/> is <see langword="null"/>.</exception>
11561159
/// <exception cref="ArgumentException"><paramref name="taskId"/> is empty or composed entirely of whitespace.</exception>
1160+
/// <exception cref="McpException">The request failed or the server returned an error response.</exception>
11571161
/// <remarks>
11581162
/// Cancelling a task requests that the server stop execution. The server may not immediately cancel the task,
11591163
/// and may choose to allow the task to complete if it's close to finishing.

src/ModelContextProtocol.Core/Server/McpServer.Methods.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,7 @@ void IDisposable.Dispose() { } // nop
10661066
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests.</param>
10671067
/// <returns>A task representing the asynchronous notification operation.</returns>
10681068
/// <exception cref="ArgumentNullException"><paramref name="task"/> is <see langword="null"/>.</exception>
1069+
/// <exception cref="McpException">The notification failed or the client returned an error response.</exception>
10691070
/// <remarks>
10701071
/// <para>
10711072
/// This method sends an optional status notification to inform the client of task state changes.

0 commit comments

Comments
 (0)