Skip to content

Commit 34d4cd7

Browse files
Copilotstephentoub
andauthored
Add missing exception documentation for public APIs (#1339)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com> Co-authored-by: Stephen Toub <stoub@microsoft.com>
1 parent 4648d3e commit 34d4cd7

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

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

Lines changed: 5 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,
@@ -1073,6 +1074,7 @@ public async ValueTask<McpTask> GetTaskAsync(
10731074
/// <returns>The raw JSON result of the task.</returns>
10741075
/// <exception cref="ArgumentNullException"><paramref name="taskId"/> is <see langword="null"/>.</exception>
10751076
/// <exception cref="ArgumentException"><paramref name="taskId"/> is empty or composed entirely of whitespace.</exception>
1077+
/// <exception cref="McpException">The request failed or the server returned an error response.</exception>
10761078
/// <remarks>
10771079
/// This method sends a tasks/result request to the server, which will block until the task completes if it hasn't already.
10781080
/// The server handles all polling logic internally.
@@ -1099,6 +1101,7 @@ public ValueTask<JsonElement> GetTaskResultAsync(
10991101
/// <param name="options">Optional request options including metadata, serialization settings, and progress tracking.</param>
11001102
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
11011103
/// <returns>A list of all tasks.</returns>
1104+
/// <exception cref="McpException">The request failed or the server returned an error response.</exception>
11021105
[Experimental(Experimentals.Tasks_DiagnosticId, UrlFormat = Experimentals.Tasks_Url)]
11031106
public async ValueTask<IList<McpTask>> ListTasksAsync(
11041107
RequestOptions? options = null,
@@ -1124,6 +1127,7 @@ public async ValueTask<IList<McpTask>> ListTasksAsync(
11241127
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
11251128
/// <returns>The result of the request as provided by the server.</returns>
11261129
/// <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>
11271131
/// <remarks>
11281132
/// The <see cref="ListTasksAsync(RequestOptions?, CancellationToken)"/> overload retrieves all tasks by automatically handling pagination.
11291133
/// This overload works with the lower-level <see cref="ListTasksRequestParams"/> and <see cref="ListTasksResult"/>, returning the raw result from the server.
@@ -1153,6 +1157,7 @@ public ValueTask<ListTasksResult> ListTasksAsync(
11531157
/// <returns>The updated state of the task after cancellation.</returns>
11541158
/// <exception cref="ArgumentNullException"><paramref name="taskId"/> is <see langword="null"/>.</exception>
11551159
/// <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>
11561161
/// <remarks>
11571162
/// Cancelling a task requests that the server stop execution. The server may not immediately cancel the task,
11581163
/// 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)