diff --git a/src/ModelContextProtocol.AspNetCore/McpEndpointRouteBuilderExtensions.cs b/src/ModelContextProtocol.AspNetCore/McpEndpointRouteBuilderExtensions.cs index 7c05ac102..8c78d7516 100644 --- a/src/ModelContextProtocol.AspNetCore/McpEndpointRouteBuilderExtensions.cs +++ b/src/ModelContextProtocol.AspNetCore/McpEndpointRouteBuilderExtensions.cs @@ -19,6 +19,7 @@ public static class McpEndpointRouteBuilderExtensions /// The web application to attach MCP HTTP endpoints. /// The route pattern prefix to map to. /// Returns a builder for configuring additional endpoint conventions like authorization policies. + /// The required MCP services have not been registered. Ensure has been called during application startup. /// /// For details about the Streamable HTTP transport, see the 2025-06-18 protocol specification. /// 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 2024-11-05 protocol specification. diff --git a/src/ModelContextProtocol.Core/Client/HttpClientTransportOptions.cs b/src/ModelContextProtocol.Core/Client/HttpClientTransportOptions.cs index 624a14aa1..43b6ef30d 100644 --- a/src/ModelContextProtocol.Core/Client/HttpClientTransportOptions.cs +++ b/src/ModelContextProtocol.Core/Client/HttpClientTransportOptions.cs @@ -10,6 +10,8 @@ public sealed class HttpClientTransportOptions /// /// Gets or sets the base address of the server for SSE connections. /// + /// The value is . + /// The value is not an absolute URI, or does not use the HTTP or HTTPS scheme. public required Uri Endpoint { get; diff --git a/src/ModelContextProtocol.Core/Client/McpClient.Methods.cs b/src/ModelContextProtocol.Core/Client/McpClient.Methods.cs index d7da8989b..d12f65c8d 100644 --- a/src/ModelContextProtocol.Core/Client/McpClient.Methods.cs +++ b/src/ModelContextProtocol.Core/Client/McpClient.Methods.cs @@ -22,6 +22,7 @@ public abstract partial class McpClient : McpSession /// An that's connected to the specified server. /// is . /// An error occurred while connecting to the server over HTTP. + /// The server returned an error response during initialization. /// /// /// When using an HTTP-based transport (such as ), this method may throw @@ -139,6 +140,7 @@ public ValueTask PingAsync( /// Optional request options including metadata, serialization settings, and progress tracking. /// The to monitor for cancellation requests. The default is . /// A list of all available tools as instances. + /// The request failed or the server returned an error response. public async ValueTask> ListToolsAsync( RequestOptions? options = null, CancellationToken cancellationToken = default) @@ -168,6 +170,7 @@ public async ValueTask> ListToolsAsync( /// The to monitor for cancellation requests. The default is . /// The result of the request as provided by the server. /// is . + /// The request failed or the server returned an error response. /// /// The overload retrieves all tools by automatically handling pagination. /// This overload works with the lower-level and , returning the raw result from the server. @@ -193,6 +196,7 @@ public ValueTask ListToolsAsync( /// Optional request options including metadata, serialization settings, and progress tracking. /// The to monitor for cancellation requests. The default is . /// A list of all available prompts as instances. + /// The request failed or the server returned an error response. public async ValueTask> ListPromptsAsync( RequestOptions? options = null, CancellationToken cancellationToken = default) @@ -222,6 +226,7 @@ public async ValueTask> ListPromptsAsync( /// The to monitor for cancellation requests. The default is . /// The result of the request as provided by the server. /// is . + /// The request failed or the server returned an error response. /// /// The overload retrieves all prompts by automatically handling pagination. /// This overload works with the lower-level and , returning the raw result from the server. @@ -251,6 +256,7 @@ public ValueTask ListPromptsAsync( /// A task containing the prompt's result with content and messages. /// is . /// is empty or composed entirely of whitespace. + /// The request failed or the server returned an error response. public ValueTask GetPromptAsync( string name, IReadOnlyDictionary? arguments = null, @@ -279,6 +285,7 @@ public ValueTask GetPromptAsync( /// The to monitor for cancellation requests. The default is . /// The result of the request as provided by the server. /// is . + /// The request failed or the server returned an error response. public ValueTask GetPromptAsync( GetPromptRequestParams requestParams, CancellationToken cancellationToken = default) @@ -299,6 +306,7 @@ public ValueTask GetPromptAsync( /// Optional request options including metadata, serialization settings, and progress tracking. /// The to monitor for cancellation requests. The default is . /// A list of all available resource templates as instances. + /// The request failed or the server returned an error response. public async ValueTask> ListResourceTemplatesAsync( RequestOptions? options = null, CancellationToken cancellationToken = default) @@ -328,6 +336,7 @@ public async ValueTask> ListResourceTemplatesAs /// The to monitor for cancellation requests. The default is . /// The result of the request as provided by the server. /// is . + /// The request failed or the server returned an error response. /// /// The overload retrieves all resource templates by automatically handling pagination. /// This overload works with the lower-level and , returning the raw result from the server. @@ -353,6 +362,7 @@ public ValueTask ListResourceTemplatesAsync( /// Optional request options including metadata, serialization settings, and progress tracking. /// The to monitor for cancellation requests. The default is . /// A list of all available resources as instances. + /// The request failed or the server returned an error response. public async ValueTask> ListResourcesAsync( RequestOptions? options = null, CancellationToken cancellationToken = default) @@ -382,6 +392,7 @@ public async ValueTask> ListResourcesAsync( /// The to monitor for cancellation requests. The default is . /// The result of the request as provided by the server. /// is . + /// The request failed or the server returned an error response. /// /// The overload retrieves all resources by automatically handling pagination. /// This overload works with the lower-level and , returning the raw result from the server. @@ -408,6 +419,7 @@ public ValueTask ListResourcesAsync( /// Optional request options including metadata, serialization settings, and progress tracking. /// The to monitor for cancellation requests. The default is . /// is . + /// The request failed or the server returned an error response. public ValueTask ReadResourceAsync( Uri uri, RequestOptions? options = null, CancellationToken cancellationToken = default) { @@ -424,6 +436,7 @@ public ValueTask ReadResourceAsync( /// The to monitor for cancellation requests. The default is . /// is . /// is empty or composed entirely of whitespace. + /// The request failed or the server returned an error response. public ValueTask ReadResourceAsync( string uri, RequestOptions? options = null, CancellationToken cancellationToken = default) { @@ -445,6 +458,7 @@ public ValueTask ReadResourceAsync( /// The to monitor for cancellation requests. The default is . /// or is . /// is empty or composed entirely of whitespace. + /// The request failed or the server returned an error response. public ValueTask ReadResourceAsync( string uriTemplate, IReadOnlyDictionary arguments, RequestOptions? options = null, CancellationToken cancellationToken = default) { @@ -467,6 +481,7 @@ public ValueTask ReadResourceAsync( /// The to monitor for cancellation requests. The default is . /// The result of the request. /// is . + /// The request failed or the server returned an error response. public ValueTask ReadResourceAsync( ReadResourceRequestParams requestParams, CancellationToken cancellationToken = default) @@ -492,6 +507,7 @@ public ValueTask ReadResourceAsync( /// A containing completion suggestions. /// or is . /// is empty or composed entirely of whitespace. + /// The request failed or the server returned an error response. public ValueTask CompleteAsync( Reference reference, string argumentName, string argumentValue, RequestOptions? options = null, CancellationToken cancellationToken = default) @@ -516,6 +532,7 @@ public ValueTask CompleteAsync( /// The to monitor for cancellation requests. The default is . /// The result of the request. /// is . + /// The request failed or the server returned an error response. public ValueTask CompleteAsync( CompleteRequestParams requestParams, CancellationToken cancellationToken = default) @@ -538,6 +555,7 @@ public ValueTask CompleteAsync( /// The to monitor for cancellation requests. The default is . /// A task that represents the asynchronous operation. /// is . + /// The request failed or the server returned an error response. public Task SubscribeToResourceAsync(Uri uri, RequestOptions? options = null, CancellationToken cancellationToken = default) { Throw.IfNull(uri); @@ -554,6 +572,7 @@ public Task SubscribeToResourceAsync(Uri uri, RequestOptions? options = null, Ca /// A task that represents the asynchronous operation. /// is . /// is empty or composed entirely of whitespace. + /// The request failed or the server returned an error response. public Task SubscribeToResourceAsync(string uri, RequestOptions? options = null, CancellationToken cancellationToken = default) { Throw.IfNullOrWhiteSpace(uri); @@ -574,6 +593,7 @@ public Task SubscribeToResourceAsync(string uri, RequestOptions? options = null, /// The to monitor for cancellation requests. The default is . /// The result of the request. /// is . + /// The request failed or the server returned an error response. /// /// /// This method subscribes to resource update notifications but does not register a handler. @@ -612,6 +632,7 @@ public Task SubscribeToResourceAsync( /// and removes the notification handler. /// /// or is . + /// The request failed or the server returned an error response. /// /// /// This method provides a convenient way to subscribe to resource updates and handle notifications in a single call. @@ -647,6 +668,7 @@ public Task SubscribeToResourceAsync( /// /// or is . /// is empty or composed entirely of whitespace. + /// The request failed or the server returned an error response. /// /// /// This method provides a convenient way to subscribe to resource updates and handle notifications in a single call. @@ -742,6 +764,7 @@ public async ValueTask DisposeAsync() /// The to monitor for cancellation requests. The default is . /// A task that represents the asynchronous operation. /// is . + /// The request failed or the server returned an error response. public Task UnsubscribeFromResourceAsync(Uri uri, RequestOptions? options = null, CancellationToken cancellationToken = default) { Throw.IfNull(uri); @@ -758,6 +781,7 @@ public Task UnsubscribeFromResourceAsync(Uri uri, RequestOptions? options = null /// A task that represents the asynchronous operation. /// is . /// is empty or composed entirely of whitespace. + /// The request failed or the server returned an error response. public Task UnsubscribeFromResourceAsync(string uri, RequestOptions? options = null, CancellationToken cancellationToken = default) { Throw.IfNullOrWhiteSpace(uri); @@ -778,6 +802,7 @@ public Task UnsubscribeFromResourceAsync(string uri, RequestOptions? options = n /// The to monitor for cancellation requests. The default is . /// The result of the request. /// is . + /// The request failed or the server returned an error response. public Task UnsubscribeFromResourceAsync( UnsubscribeRequestParams requestParams, CancellationToken cancellationToken = default) @@ -802,6 +827,7 @@ public Task UnsubscribeFromResourceAsync( /// The to monitor for cancellation requests. The default is . /// The from the tool execution. /// is . + /// The request failed or the server returned an error response. public ValueTask CallToolAsync( string toolName, IReadOnlyDictionary? arguments = null, @@ -871,6 +897,7 @@ async ValueTask SendRequestWithProgressAsync( /// The to monitor for cancellation requests. The default is . /// The result of the request. /// is . + /// The request failed or the server returned an error response. public ValueTask CallToolAsync( CallToolRequestParams requestParams, CancellationToken cancellationToken = default) @@ -892,6 +919,7 @@ public ValueTask CallToolAsync( /// Optional request options including metadata, serialization settings, and progress tracking. /// The to monitor for cancellation requests. The default is . /// A task representing the asynchronous operation. + /// The request failed or the server returned an error response. public Task SetLoggingLevelAsync(LogLevel level, RequestOptions? options = null, CancellationToken cancellationToken = default) => SetLoggingLevelAsync(McpServerImpl.ToLoggingLevel(level), options, cancellationToken); @@ -902,6 +930,7 @@ public Task SetLoggingLevelAsync(LogLevel level, RequestOptions? options = null, /// Optional request options including metadata, serialization settings, and progress tracking. /// The to monitor for cancellation requests. The default is . /// A task representing the asynchronous operation. + /// The request failed or the server returned an error response. public Task SetLoggingLevelAsync(LoggingLevel level, RequestOptions? options = null, CancellationToken cancellationToken = default) { return SetLoggingLevelAsync( @@ -920,6 +949,7 @@ public Task SetLoggingLevelAsync(LoggingLevel level, RequestOptions? options = n /// The to monitor for cancellation requests. The default is . /// The result of the request. /// is . + /// The request failed or the server returned an error response. public Task SetLoggingLevelAsync( SetLevelRequestParams requestParams, CancellationToken cancellationToken = default) diff --git a/src/ModelContextProtocol.Core/Client/McpClientPrompt.cs b/src/ModelContextProtocol.Core/Client/McpClientPrompt.cs index 448f53737..7ba91c3d3 100644 --- a/src/ModelContextProtocol.Core/Client/McpClientPrompt.cs +++ b/src/ModelContextProtocol.Core/Client/McpClientPrompt.cs @@ -77,6 +77,7 @@ public McpClientPrompt(McpClient client, Prompt prompt) /// The serialization options governing argument serialization. /// The to monitor for cancellation requests. The default is . /// A containing the prompt's result with content and messages. + /// The request failed or the server returned an error response. /// /// /// This method sends a request to the MCP server to execute this prompt with the provided arguments. diff --git a/src/ModelContextProtocol.Core/Client/McpClientResource.cs b/src/ModelContextProtocol.Core/Client/McpClientResource.cs index c8c4c75d6..a74cc2302 100644 --- a/src/ModelContextProtocol.Core/Client/McpClientResource.cs +++ b/src/ModelContextProtocol.Core/Client/McpClientResource.cs @@ -76,6 +76,7 @@ public McpClientResource(McpClient client, Resource resource) /// /// The to monitor for cancellation requests. The default is . /// A containing the resource's result with content and messages. + /// The request failed or the server returned an error response. /// /// /// This is a convenience method that internally calls . diff --git a/src/ModelContextProtocol.Core/Client/McpClientResourceTemplate.cs b/src/ModelContextProtocol.Core/Client/McpClientResourceTemplate.cs index c9eb1fb7c..b0214da42 100644 --- a/src/ModelContextProtocol.Core/Client/McpClientResourceTemplate.cs +++ b/src/ModelContextProtocol.Core/Client/McpClientResourceTemplate.cs @@ -80,6 +80,7 @@ public McpClientResourceTemplate(McpClient client, ResourceTemplate resourceTemp /// /// The to monitor for cancellation requests. The default is . /// A containing the resource template's result with content and messages. + /// The request failed or the server returned an error response. public ValueTask ReadAsync( IReadOnlyDictionary arguments, CancellationToken cancellationToken = default) => diff --git a/src/ModelContextProtocol.Core/Client/StdioClientTransportOptions.cs b/src/ModelContextProtocol.Core/Client/StdioClientTransportOptions.cs index 94425ebe7..2d6df08b4 100644 --- a/src/ModelContextProtocol.Core/Client/StdioClientTransportOptions.cs +++ b/src/ModelContextProtocol.Core/Client/StdioClientTransportOptions.cs @@ -8,6 +8,7 @@ public sealed class StdioClientTransportOptions /// /// Gets or sets the command to execute to start the server process. /// + /// The value is , empty, or composed entirely of whitespace. public required string Command { get; diff --git a/src/ModelContextProtocol.Core/McpSession.Methods.cs b/src/ModelContextProtocol.Core/McpSession.Methods.cs index 3bba48b17..b52aadbc8 100644 --- a/src/ModelContextProtocol.Core/McpSession.Methods.cs +++ b/src/ModelContextProtocol.Core/McpSession.Methods.cs @@ -18,6 +18,9 @@ public abstract partial class McpSession : IAsyncDisposable /// The options governing request serialization. /// The to monitor for cancellation requests. The default is . /// A task that represents the asynchronous operation. The task result contains the deserialized result. + /// is . + /// is empty or composed entirely of whitespace. + /// The request failed or the server returned an error response. public ValueTask SendRequestAsync( string method, TParameters parameters, diff --git a/src/ModelContextProtocol.Core/McpSession.cs b/src/ModelContextProtocol.Core/McpSession.cs index b0469aec0..63d218f4e 100644 --- a/src/ModelContextProtocol.Core/McpSession.cs +++ b/src/ModelContextProtocol.Core/McpSession.cs @@ -86,6 +86,8 @@ public abstract partial class McpSession : IAsyncDisposable /// The notification method. /// The handler to be invoked. /// An that will remove the registered handler when disposed. + /// or is . + /// is empty or composed entirely of whitespace. public abstract IAsyncDisposable RegisterNotificationHandler(string method, Func handler); /// diff --git a/src/ModelContextProtocol.Core/Protocol/ElicitRequestParams.cs b/src/ModelContextProtocol.Core/Protocol/ElicitRequestParams.cs index 8f222caa0..80a71cbeb 100644 --- a/src/ModelContextProtocol.Core/Protocol/ElicitRequestParams.cs +++ b/src/ModelContextProtocol.Core/Protocol/ElicitRequestParams.cs @@ -20,6 +20,7 @@ public sealed class ElicitRequestParams : RequestParams /// url: Client navigates user to a URL for out-of-band interaction. Sensitive data is not exposed to the client. /// /// + /// The value is not "form" or "url". [JsonPropertyName("mode")] [field: MaybeNull] public string Mode diff --git a/src/ModelContextProtocol.Core/Protocol/Tool.cs b/src/ModelContextProtocol.Core/Protocol/Tool.cs index 30b1242b5..dd38eb3f0 100644 --- a/src/ModelContextProtocol.Core/Protocol/Tool.cs +++ b/src/ModelContextProtocol.Core/Protocol/Tool.cs @@ -39,6 +39,7 @@ public sealed class Tool : IBaseMetadata /// /// Gets or sets a JSON Schema object defining the expected parameters for the tool. /// + /// The value is not a valid MCP tool JSON schema. /// /// /// The schema must be a valid JSON Schema object with the "type" property set to "object". @@ -73,6 +74,7 @@ public JsonElement InputSchema /// /// Gets or sets a JSON Schema object defining the expected structured outputs for the tool. /// + /// The value is not a valid MCP tool JSON schema. /// /// /// The schema must be a valid JSON Schema object with the "type" property set to "object". diff --git a/src/ModelContextProtocol.Core/Server/McpServer.Methods.cs b/src/ModelContextProtocol.Core/Server/McpServer.Methods.cs index cd052d0ee..7caabf686 100644 --- a/src/ModelContextProtocol.Core/Server/McpServer.Methods.cs +++ b/src/ModelContextProtocol.Core/Server/McpServer.Methods.cs @@ -52,6 +52,7 @@ public static McpServer Create( /// A task containing the sampling result from the client. /// is . /// The client does not support sampling. + /// The request failed or the client returned an error response. public ValueTask SampleAsync( CreateMessageRequestParams requestParams, CancellationToken cancellationToken = default) @@ -76,6 +77,7 @@ public ValueTask SampleAsync( /// A task containing the chat response from the model. /// is . /// The client does not support sampling. + /// The request failed or the client returned an error response. public async Task SampleAsync( IEnumerable messages, ChatOptions? chatOptions = default, CancellationToken cancellationToken = default) { @@ -222,6 +224,7 @@ public ILoggerProvider AsClientLoggerProvider() => /// A task containing the list of roots exposed by the client. /// is . /// The client does not support roots. + /// The request failed or the client returned an error response. public ValueTask RequestRootsAsync( ListRootsRequestParams requestParams, CancellationToken cancellationToken = default) @@ -245,6 +248,7 @@ public ValueTask RequestRootsAsync( /// A task containing the elicitation result. /// is . /// The client does not support elicitation. + /// The request failed or the client returned an error response. public ValueTask ElicitAsync( ElicitRequestParams requestParams, CancellationToken cancellationToken = default) @@ -272,6 +276,7 @@ public ValueTask ElicitAsync( /// is . /// is empty or composed entirely of whitespace. /// The client does not support elicitation. + /// The request failed or the client returned an error response. /// /// Elicitation uses a constrained subset of JSON Schema and only supports strings, numbers/integers, booleans and string enums. /// Unsupported member types are ignored when constructing the schema.