Skip to content

Commit 28aaeab

Browse files
Copilotstephentoub
andcommitted
Add exception docs to HttpClientTransportOptions, StdioClientTransportOptions, ElicitRequestParams, Tool, and McpEndpointRouteBuilderExtensions
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
1 parent 11e43eb commit 28aaeab

5 files changed

Lines changed: 7 additions & 0 deletions

File tree

src/ModelContextProtocol.AspNetCore/McpEndpointRouteBuilderExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public static class McpEndpointRouteBuilderExtensions
1919
/// <param name="endpoints">The web application to attach MCP HTTP endpoints.</param>
2020
/// <param name="pattern">The route pattern prefix to map to.</param>
2121
/// <returns>Returns a builder for configuring additional endpoint conventions like authorization policies.</returns>
22+
/// <exception cref="InvalidOperationException">The required MCP services have not been registered. Ensure <see cref="HttpMcpServerBuilderExtensions.WithHttpTransport"/> has been called during application startup.</exception>
2223
/// <remarks>
2324
/// For details about the Streamable HTTP transport, see the <see href="https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#streamable-http">2025-06-18 protocol specification</see>.
2425
/// This method also maps legacy SSE endpoints for backward compatibility at the path "/sse" and "/message". For details about the HTTP with SSE transport, see the <see href="https://modelcontextprotocol.io/specification/2024-11-05/basic/transports#http-with-sse">2024-11-05 protocol specification</see>.

src/ModelContextProtocol.Core/Client/HttpClientTransportOptions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ public sealed class HttpClientTransportOptions
1010
/// <summary>
1111
/// Gets or sets the base address of the server for SSE connections.
1212
/// </summary>
13+
/// <exception cref="ArgumentNullException"><paramref name="value"/> is <see langword="null"/>.</exception>
14+
/// <exception cref="ArgumentException"><paramref name="value"/> is not an absolute URI, or does not use the HTTP or HTTPS scheme.</exception>
1315
public required Uri Endpoint
1416
{
1517
get;

src/ModelContextProtocol.Core/Client/StdioClientTransportOptions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public sealed class StdioClientTransportOptions
88
/// <summary>
99
/// Gets or sets the command to execute to start the server process.
1010
/// </summary>
11+
/// <exception cref="ArgumentException"><paramref name="value"/> is <see langword="null"/>, empty, or composed entirely of whitespace.</exception>
1112
public required string Command
1213
{
1314
get;

src/ModelContextProtocol.Core/Protocol/ElicitRequestParams.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public sealed class ElicitRequestParams : RequestParams
2020
/// <item><description><b>url</b>: Client navigates user to a URL for out-of-band interaction. Sensitive data is not exposed to the client.</description></item>
2121
/// </list>
2222
/// </remarks>
23+
/// <exception cref="ArgumentException"><paramref name="value"/> is not "form" or "url".</exception>
2324
[JsonPropertyName("mode")]
2425
[field: MaybeNull]
2526
public string Mode

src/ModelContextProtocol.Core/Protocol/Tool.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public sealed class Tool : IBaseMetadata
3939
/// <summary>
4040
/// Gets or sets a JSON Schema object defining the expected parameters for the tool.
4141
/// </summary>
42+
/// <exception cref="ArgumentException"><paramref name="value"/> is not a valid MCP tool JSON schema.</exception>
4243
/// <remarks>
4344
/// <para>
4445
/// The schema must be a valid JSON Schema object with the "type" property set to "object".
@@ -73,6 +74,7 @@ public JsonElement InputSchema
7374
/// <summary>
7475
/// Gets or sets a JSON Schema object defining the expected structured outputs for the tool.
7576
/// </summary>
77+
/// <exception cref="ArgumentException"><paramref name="value"/> is not a valid MCP tool JSON schema.</exception>
7678
/// <remarks>
7779
/// <para>
7880
/// The schema must be a valid JSON Schema object with the "type" property set to "object".

0 commit comments

Comments
 (0)