diff --git a/src/ModelContextProtocol.Core/Authentication/ClientOAuthOptions.cs b/src/ModelContextProtocol.Core/Authentication/ClientOAuthOptions.cs index d0504b6..483e364 100644 --- a/src/ModelContextProtocol.Core/Authentication/ClientOAuthOptions.cs +++ b/src/ModelContextProtocol.Core/Authentication/ClientOAuthOptions.cs @@ -19,7 +19,7 @@ public sealed class ClientOAuthOptions /// Gets or sets the OAuth client secret. /// /// - /// This is optional for public clients or when using PKCE without client authentication. + /// This secret is optional for public clients or when using PKCE without client authentication. /// public string? ClientSecret { get; set; } @@ -43,7 +43,7 @@ public sealed class ClientOAuthOptions /// If not specified, the provider will use the scopes from the protected resource metadata. /// /// - /// Common OAuth scopes include "openid", "profile", "email", etc. + /// Common OAuth scopes include "openid", "profile", and "email". /// /// public IEnumerable? Scopes { get; set; } @@ -82,7 +82,7 @@ public sealed class ClientOAuthOptions /// Gets or sets the options to use during dynamic client registration. /// /// - /// Only used when a is not specified. + /// This value is only used when no is specified. /// public DynamicClientRegistrationOptions? DynamicClientRegistration { get; set; } @@ -92,7 +92,7 @@ public sealed class ClientOAuthOptions /// /// /// - /// Parameters specified cannot override or append to any automatically set parameters like the "redirect_uri" + /// Parameters specified cannot override or append to any automatically set parameters like the "redirect_uri", /// which should instead be configured via . /// /// @@ -103,4 +103,4 @@ public sealed class ClientOAuthOptions /// If none is provided, tokens will be cached with the transport. /// public ITokenCache? TokenCache { get; set; } -} \ No newline at end of file +} diff --git a/src/ModelContextProtocol.Core/Authentication/ClientOAuthProvider.cs b/src/ModelContextProtocol.Core/Authentication/ClientOAuthProvider.cs index 3d50bb2..e895272 100644 --- a/src/ModelContextProtocol.Core/Authentication/ClientOAuthProvider.cs +++ b/src/ModelContextProtocol.Core/Authentication/ClientOAuthProvider.cs @@ -52,9 +52,9 @@ internal sealed partial class ClientOAuthProvider /// /// The MCP server URL. /// The OAuth provider configuration options. - /// The HTTP client to use for OAuth requests. If null, a default HttpClient will be used. + /// The HTTP client to use for OAuth requests. If null, a default HttpClient is used. /// A logger factory to handle diagnostic messages. - /// Thrown when serverUrl or options are null. + /// or is null. public ClientOAuthProvider( Uri serverUrl, ClientOAuthOptions options, @@ -136,7 +136,7 @@ internal sealed partial class ClientOAuthProvider /// The authentication scheme to use. /// The URI of the resource requiring authentication. /// A token to cancel the operation. - /// An authentication token string or null if no token could be obtained for the specified scheme. + /// An authentication token string, or null if no token could be obtained for the specified scheme. public async Task GetCredentialAsync(string scheme, Uri resourceUri, CancellationToken cancellationToken = default) { ThrowIfNotBearerScheme(scheme); @@ -186,8 +186,8 @@ internal sealed partial class ClientOAuthProvider /// Performs OAuth authorization by selecting an appropriate authorization server and completing the OAuth flow. /// /// The 401 Unauthorized response containing authentication challenge. - /// Cancellation token. - /// Result indicating whether authorization was successful. + /// The cancellation token. + /// A result object indicating whether authorization was successful. private async Task PerformOAuthAuthorizationAsync( HttpResponseMessage response, CancellationToken cancellationToken) diff --git a/src/ModelContextProtocol.Core/Authentication/DynamicClientRegistrationOptions.cs b/src/ModelContextProtocol.Core/Authentication/DynamicClientRegistrationOptions.cs index c733712..5d145a5 100644 --- a/src/ModelContextProtocol.Core/Authentication/DynamicClientRegistrationOptions.cs +++ b/src/ModelContextProtocol.Core/Authentication/DynamicClientRegistrationOptions.cs @@ -9,7 +9,7 @@ public sealed class DynamicClientRegistrationOptions /// Gets or sets the client name to use during dynamic client registration. /// /// - /// This is a human-readable name for the client that may be displayed to users during authorization. + /// This value is a human-readable name for the client that can be displayed to users during authorization. /// public string? ClientName { get; set; } @@ -17,7 +17,7 @@ public sealed class DynamicClientRegistrationOptions /// Gets or sets the client URI to use during dynamic client registration. /// /// - /// This should be a URL pointing to the client's home page or information page. + /// This value should be a URL pointing to the client's home page or information page. /// public Uri? ClientUri { get; set; } @@ -29,7 +29,7 @@ public sealed class DynamicClientRegistrationOptions /// This token is used to authenticate the client during the registration process. /// /// - /// This is required if the authorization server does not allow anonymous client registration. + /// This token is required if the authorization server does not allow anonymous client registration. /// /// public string? InitialAccessToken { get; set; } @@ -46,4 +46,4 @@ public sealed class DynamicClientRegistrationOptions /// /// public Func? ResponseDelegate { get; set; } -} \ No newline at end of file +} diff --git a/src/ModelContextProtocol.Core/Authentication/DynamicClientRegistrationResponse.cs b/src/ModelContextProtocol.Core/Authentication/DynamicClientRegistrationResponse.cs index 1dfe122..7d78a69 100644 --- a/src/ModelContextProtocol.Core/Authentication/DynamicClientRegistrationResponse.cs +++ b/src/ModelContextProtocol.Core/Authentication/DynamicClientRegistrationResponse.cs @@ -8,50 +8,50 @@ namespace ModelContextProtocol.Authentication; public sealed class DynamicClientRegistrationResponse { /// - /// Gets or sets the client identifier. + /// Gets or initializes the client identifier. /// [JsonPropertyName("client_id")] public required string ClientId { get; init; } /// - /// Gets or sets the client secret. + /// Gets or initializes the client secret. /// [JsonPropertyName("client_secret")] public string? ClientSecret { get; init; } /// - /// Gets or sets the redirect URIs for the client. + /// Gets or initializes the redirect URIs for the client. /// [JsonPropertyName("redirect_uris")] public string[]? RedirectUris { get; init; } /// - /// Gets or sets the token endpoint authentication method. + /// Gets or initializes the token endpoint authentication method. /// [JsonPropertyName("token_endpoint_auth_method")] public string? TokenEndpointAuthMethod { get; init; } /// - /// Gets or sets the grant types that the client will use. + /// Gets or initializes the grant types that the client will use. /// [JsonPropertyName("grant_types")] public string[]? GrantTypes { get; init; } /// - /// Gets or sets the response types that the client will use. + /// Gets or initializes the response types that the client will use. /// [JsonPropertyName("response_types")] public string[]? ResponseTypes { get; init; } /// - /// Gets or sets the client ID issued timestamp. + /// Gets or initializes the timestamp at which the client ID was issued. /// [JsonPropertyName("client_id_issued_at")] public long? ClientIdIssuedAt { get; init; } /// - /// Gets or sets the client secret expiration time. + /// Gets or initializes the client secret expiration time. /// [JsonPropertyName("client_secret_expires_at")] public long? ClientSecretExpiresAt { get; init; } -} \ No newline at end of file +} diff --git a/src/ModelContextProtocol.Core/Authentication/ProtectedResourceMetadata.cs b/src/ModelContextProtocol.Core/Authentication/ProtectedResourceMetadata.cs index 88b5bcc..c2d1a6e 100644 --- a/src/ModelContextProtocol.Core/Authentication/ProtectedResourceMetadata.cs +++ b/src/ModelContextProtocol.Core/Authentication/ProtectedResourceMetadata.cs @@ -9,66 +9,81 @@ namespace ModelContextProtocol.Authentication; public sealed class ProtectedResourceMetadata { /// - /// The resource URI. + /// Gets or sets the resource URI. /// + /// + /// The protected resource's resource identifier. + /// /// - /// REQUIRED. The protected resource's resource identifier. + /// REQUIRED. /// [JsonPropertyName("resource")] public required Uri Resource { get; set; } /// - /// The list of authorization server URIs. + /// Gets or sets the list of authorization server URIs. /// - /// - /// OPTIONAL. JSON array containing a list of OAuth authorization server issuer identifiers + /// + /// A JSON array containing a list of OAuth authorization server issuer identifiers /// for authorization servers that can be used with this protected resource. + /// + /// + /// OPTIONAL. /// [JsonPropertyName("authorization_servers")] public List AuthorizationServers { get; set; } = []; /// - /// The supported bearer token methods. + /// Gets or sets the supported bearer token methods. /// - /// - /// OPTIONAL. JSON array containing a list of the supported methods of sending an OAuth 2.0 bearer token + /// + /// A JSON array containing a list of the supported methods of sending an OAuth 2.0 bearer token /// to the protected resource. Defined values are ["header", "body", "query"]. + /// + /// + /// OPTIONAL. /// [JsonPropertyName("bearer_methods_supported")] public List BearerMethodsSupported { get; set; } = ["header"]; /// - /// The supported scopes. + /// Gets or sets the supported scopes. /// - /// - /// RECOMMENDED. JSON array containing a list of scope values that are used in authorization + /// + /// A JSON array containing a list of scope values that are used in authorization /// requests to request access to this protected resource. + /// + /// + /// RECOMMENDED. /// [JsonPropertyName("scopes_supported")] public List ScopesSupported { get; set; } = []; /// - /// URL of the protected resource's JSON Web Key (JWK) Set document. + /// Gets or sets the URL of the protected resource's JSON Web Key (JWK) Set document. /// /// - /// OPTIONAL. This contains public keys belonging to the protected resource, such as signing key(s) - /// that the resource server uses to sign resource responses. This URL MUST use the https scheme. + /// OPTIONAL. This document contains public keys belonging to the protected resource, such as signing keys + /// that the resource server uses to sign resource responses. This URL MUST use the HTTPS scheme. /// [JsonPropertyName("jwks_uri")] public Uri? JwksUri { get; set; } /// - /// List of the JWS signing algorithms supported by the protected resource for signing resource responses. + /// Gets or sets the list of the JWS signing algorithms supported by the protected resource for signing resource responses. /// + /// + /// A JSON array containing a list of the JWS signing algorithms (alg values) supported by the protected resource + /// for signing resource responses. + /// /// - /// OPTIONAL. JSON array containing a list of the JWS signing algorithms (alg values) supported by the protected resource - /// for signing resource responses. No default algorithms are implied if this entry is omitted. The value none MUST NOT be used. + /// OPTIONAL. No default algorithms are implied if this entry is omitted. The value "none" MUST NOT be used. /// [JsonPropertyName("resource_signing_alg_values_supported")] public List? ResourceSigningAlgValuesSupported { get; set; } /// - /// Human-readable name of the protected resource intended for display to the end user. + /// Gets or sets the human-readable name of the protected resource intended for display to the end user. /// /// /// RECOMMENDED. It is recommended that protected resource metadata include this field. @@ -78,26 +93,32 @@ public sealed class ProtectedResourceMetadata public string? ResourceName { get; set; } /// - /// The URI to the resource documentation. + /// Gets or sets the URI to the resource documentation. /// - /// - /// OPTIONAL. URL of a page containing human-readable information that developers might want or need to know + /// + /// The URL of a page containing human-readable information that developers might want or need to know /// when using the protected resource. + /// + /// + /// OPTIONAL. /// [JsonPropertyName("resource_documentation")] public Uri? ResourceDocumentation { get; set; } /// - /// URL of a page containing human-readable information about the protected resource's requirements. + /// Gets or sets the URL of a page containing human-readable information about the protected resource's requirements. /// + /// + /// The URL of a page that contains information about how the client can use the data provided by the protected resource. + /// /// - /// OPTIONAL. Information about how the client can use the data provided by the protected resource. + /// OPTIONAL. /// [JsonPropertyName("resource_policy_uri")] public Uri? ResourcePolicyUri { get; set; } /// - /// URL of a page containing human-readable information about the protected resource's terms of service. + /// Gets or sets the URL of a page containing human-readable information about the protected resource's terms of service. /// /// /// OPTIONAL. The value of this field MAY be internationalized. @@ -106,40 +127,52 @@ public sealed class ProtectedResourceMetadata public Uri? ResourceTosUri { get; set; } /// - /// Boolean value indicating protected resource support for mutual-TLS client certificate-bound access tokens. + /// Gets or sets a value indicating whether there is protected resource support for mutual-TLS client certificate-bound access tokens. /// + /// + /// if there's protected resource support for mutual-TLS client certificate-bound access tokens; otherwise, . The default is . + /// /// - /// OPTIONAL. If omitted, the default value is false. + /// OPTIONAL. /// [JsonPropertyName("tls_client_certificate_bound_access_tokens")] public bool? TlsClientCertificateBoundAccessTokens { get; set; } /// - /// List of the authorization details type values supported by the resource server. + /// Gets or sets the list of the authorization details type values supported by the resource server. /// - /// - /// OPTIONAL. JSON array containing a list of the authorization details type values supported by the resource server + /// + /// A JSON array containing a list of the authorization details type values supported by the resource server /// when the authorization_details request parameter is used. + /// + /// + /// OPTIONAL. /// [JsonPropertyName("authorization_details_types_supported")] public List? AuthorizationDetailsTypesSupported { get; set; } /// - /// List of the JWS algorithm values supported by the resource server for validating DPoP proof JWTs. + /// Gets or sets the list of the JWS algorithm values supported by the resource server for validating DPoP proof JWTs. /// - /// - /// OPTIONAL. JSON array containing a list of the JWS alg values supported by the resource server + /// + /// A JSON array containing a list of the JWS alg values supported by the resource server /// for validating Demonstrating Proof of Possession (DPoP) proof JWTs. + /// + /// + /// OPTIONAL. /// [JsonPropertyName("dpop_signing_alg_values_supported")] public List? DpopSigningAlgValuesSupported { get; set; } /// - /// Boolean value specifying whether the protected resource always requires the use of DPoP-bound access tokens. + /// Gets or sets a value indicating whether the protected resource always requires the use of DPoP-bound access tokens. /// + /// + /// if the protected resource always requires the use of DPoP-bound access tokens; otherwise, . The default is . + /// /// - /// OPTIONAL. If omitted, the default value is false. + /// OPTIONAL. /// [JsonPropertyName("dpop_bound_access_tokens_required")] public bool? DpopBoundAccessTokensRequired { get; set; } -} \ No newline at end of file +} diff --git a/src/ModelContextProtocol.Core/Client/HttpClientTransport.cs b/src/ModelContextProtocol.Core/Client/HttpClientTransport.cs index 7c6eeec..f49a496 100644 --- a/src/ModelContextProtocol.Core/Client/HttpClientTransport.cs +++ b/src/ModelContextProtocol.Core/Client/HttpClientTransport.cs @@ -9,7 +9,7 @@ namespace ModelContextProtocol.Client; /// /// /// This transport connects to an MCP server over HTTP using SSE or Streamable HTTP, -/// allowing for real-time server-to-client communication with a standard HTTP requests. +/// allowing for real-time server-to-client communication with standard HTTP requests. /// Unlike the , this transport connects to an existing server /// rather than launching a new process. /// @@ -24,8 +24,8 @@ public sealed class HttpClientTransport : IClientTransport, IAsyncDisposable /// /// Initializes a new instance of the class. /// - /// Configuration options for the transport. - /// Logger factory for creating loggers used for diagnostic output during transport operations. + /// The configuration options for the transport. + /// The logger factory for creating loggers used for diagnostic output during transport operations. public HttpClientTransport(HttpClientTransportOptions transportOptions, ILoggerFactory? loggerFactory = null) : this(transportOptions, new HttpClient(), loggerFactory, ownsHttpClient: true) { @@ -34,9 +34,9 @@ public sealed class HttpClientTransport : IClientTransport, IAsyncDisposable /// /// Initializes a new instance of the class with a provided HTTP client. /// - /// Configuration options for the transport. + /// The configuration options for the transport. /// The HTTP client instance used for requests. - /// Logger factory for creating loggers used for diagnostic output during transport operations. + /// The logger factory for creating loggers used for diagnostic output during transport operations. /// /// to dispose of when the transport is disposed; /// if the caller is retaining ownership of the 's lifetime. @@ -108,4 +108,4 @@ public sealed class HttpClientTransport : IClientTransport, IAsyncDisposable _ownedHttpClient?.Dispose(); return default; } -} \ No newline at end of file +} diff --git a/src/ModelContextProtocol.Core/Client/HttpClientTransportOptions.cs b/src/ModelContextProtocol.Core/Client/HttpClientTransportOptions.cs index c181966..624a14a 100644 --- a/src/ModelContextProtocol.Core/Client/HttpClientTransportOptions.cs +++ b/src/ModelContextProtocol.Core/Client/HttpClientTransportOptions.cs @@ -33,18 +33,17 @@ public sealed class HttpClientTransportOptions } /// - /// Gets or sets the transport mode to use for the connection. Defaults to . + /// Gets or sets the transport mode to use for the connection. /// + /// + /// The transport mode to use for the connection. The default is . + /// /// - /// /// When set to (the default), the client will first attempt to use /// Streamable HTTP transport and automatically fall back to SSE transport if the server doesn't support it. - /// - /// - /// Streamable HTTP transport specification. - /// HTTP with SSE transport specification. - /// /// + /// Streamable HTTP transport specification. + /// HTTP with SSE transport specification. public HttpTransportMode TransportMode { get; set; } = HttpTransportMode.AutoDetect; /// @@ -53,20 +52,23 @@ public sealed class HttpClientTransportOptions public string? Name { get; set; } /// - /// Gets or sets a timeout used to establish the initial connection to the SSE server. Defaults to 30 seconds. + /// Gets or sets a timeout used to establish the initial connection to the SSE server. /// + /// + /// The timeout used to establish the initial connection to the SSE server. The default is 30 seconds. + /// /// /// This timeout controls how long the client waits for: /// - /// The initial HTTP connection to be established with the SSE server - /// The endpoint event to be received, which indicates the message endpoint URL + /// The initial HTTP connection to be established with the SSE server. + /// The endpoint event to be received, which indicates the message endpoint URL. /// - /// If the timeout expires before the connection is established, a will be thrown. + /// If the timeout expires before the connection is established, a is thrown. /// public TimeSpan ConnectionTimeout { get; set; } = TimeSpan.FromSeconds(30); /// - /// Gets custom HTTP headers to include in requests to the SSE server. + /// Gets or sets custom HTTP headers to include in requests to the SSE server. /// /// /// Use this property to specify custom HTTP headers that should be sent with each request to the server. @@ -104,4 +106,4 @@ public sealed class HttpClientTransportOptions /// Gets sor sets the authorization provider to use for authentication. /// public ClientOAuthOptions? OAuth { get; set; } -} \ No newline at end of file +} diff --git a/src/ModelContextProtocol.Core/Client/IClientTransport.cs b/src/ModelContextProtocol.Core/Client/IClientTransport.cs index 2201e9b..4ab853c 100644 --- a/src/ModelContextProtocol.Core/Client/IClientTransport.cs +++ b/src/ModelContextProtocol.Core/Client/IClientTransport.cs @@ -26,15 +26,15 @@ public interface IClientTransport /// Asynchronously establishes a transport session with an MCP server and returns a transport for the duplex message stream. /// /// The to monitor for cancellation requests. The default is . - /// Returns an interface for the duplex message stream. + /// An interface for the duplex message stream. /// /// - /// This method is responsible for initializing the connection to the server using the specific transport - /// mechanism implemented by the derived class. The returned interface + /// This method is responsible for initializing the connection to the server using the specific transport + /// mechanism implemented by the derived class. The returned interface /// provides methods to send and receive messages over the established connection. /// /// - /// The lifetime of the returned instance is typically managed by the + /// The lifetime of the returned instance is typically managed by the /// that uses this transport. When the client is disposed, it will dispose /// the transport session as well. /// diff --git a/src/ModelContextProtocol.Core/Client/McpClient.Methods.cs b/src/ModelContextProtocol.Core/Client/McpClient.Methods.cs index f246ee0..f6545d9 100644 --- a/src/ModelContextProtocol.Core/Client/McpClient.Methods.cs +++ b/src/ModelContextProtocol.Core/Client/McpClient.Methods.cs @@ -17,14 +17,13 @@ public abstract partial class McpClient : McpSession, IMcpClient /// Creates an , connecting it to the specified server. /// The transport instance used to communicate with the server. /// - /// A client configuration object which specifies client capabilities and protocol version. - /// If , details based on the current process will be employed. + /// A client configuration object that specifies client capabilities and protocol version. + /// If , details based on the current process are used. /// /// A logger factory for creating loggers for clients. /// The to monitor for cancellation requests. The default is . /// An that's connected to the specified server. - /// is . - /// is . + /// or is . public static async Task CreateAsync( IClientTransport clientTransport, McpClientOptions? clientOptions = null, @@ -85,7 +84,7 @@ public abstract partial class McpClient : McpSession, IMcpClient /// /// The to monitor for cancellation requests. The default is . /// A task that completes when the ping is successful. - /// Thrown when the server cannot be reached or returns an error response. + /// The server cannot be reached or returned an error response. public Task PingAsync(CancellationToken cancellationToken = default) { var opts = McpJsonUtilities.DefaultOptions; @@ -100,7 +99,7 @@ public abstract partial class McpClient : McpSession, IMcpClient /// /// Retrieves a list of available tools from the server. /// - /// The serializer options governing tool parameter serialization. If null, the default options will be used. + /// The serializer options governing tool parameter serialization. If null, the default options are used. /// The to monitor for cancellation requests. The default is . /// A list of all available tools as instances. public async ValueTask> ListToolsAsync( @@ -137,7 +136,7 @@ public abstract partial class McpClient : McpSession, IMcpClient /// /// Creates an enumerable for asynchronously enumerating all available tools from the server. /// - /// The serializer options governing tool parameter serialization. If null, the default options will be used. + /// The serializer options governing tool parameter serialization. If null, the default options are used. /// The to monitor for cancellation requests. The default is . /// An asynchronous sequence of all available tools as instances. public async IAsyncEnumerable EnumerateToolsAsync( @@ -231,7 +230,7 @@ public abstract partial class McpClient : McpSession, IMcpClient /// Retrieves a specific prompt from the MCP server. /// /// The name of the prompt to retrieve. - /// Optional arguments for the prompt. Keys are parameter names, and values are the argument values. + /// Optional arguments for the prompt. The dictionary keys are parameter names, and the values are the argument values. /// The serialization options governing argument serialization. /// The to monitor for cancellation requests. The default is . /// A task containing the prompt's result with content and messages. @@ -379,7 +378,7 @@ public abstract partial class McpClient : McpSession, IMcpClient /// /// Reads a resource from the server. /// - /// The uri of the resource. + /// The URI of the resource. /// The to monitor for cancellation requests. The default is . public ValueTask ReadResourceAsync( string uri, CancellationToken cancellationToken = default) @@ -397,7 +396,7 @@ public abstract partial class McpClient : McpSession, IMcpClient /// /// Reads a resource from the server. /// - /// The uri of the resource. + /// The URI of the resource. /// The to monitor for cancellation requests. The default is . public ValueTask ReadResourceAsync( Uri uri, CancellationToken cancellationToken = default) @@ -410,7 +409,7 @@ public abstract partial class McpClient : McpSession, IMcpClient /// /// Reads a resource from the server. /// - /// The uri template of the resource. + /// The URI template of the resource. /// Arguments to use to format . /// The to monitor for cancellation requests. The default is . public ValueTask ReadResourceAsync( @@ -517,10 +516,10 @@ public abstract partial class McpClient : McpSession, IMcpClient /// /// Invokes a tool on the server. /// - /// The name of the tool to call on the server.. + /// The name of the tool to call on the server. /// An optional dictionary of arguments to pass to the tool. - /// Optional progress reporter for server notifications. - /// JSON serializer options. + /// An optional progress reporter for server notifications. + /// The JSON serializer options. /// A cancellation token. /// The from the tool execution. public ValueTask CallToolAsync( @@ -610,7 +609,7 @@ public abstract partial class McpClient : McpSession, IMcpClient public Task SetLoggingLevel(LogLevel level, CancellationToken cancellationToken = default) => SetLoggingLevel(McpServerImpl.ToLoggingLevel(level), cancellationToken); - /// Convers a dictionary with values to a dictionary with values. + /// Converts a dictionary with values to a dictionary with values. private static Dictionary? ToArgumentsDictionary( IReadOnlyDictionary? arguments, JsonSerializerOptions options) { diff --git a/src/ModelContextProtocol.Core/Client/McpClient.cs b/src/ModelContextProtocol.Core/Client/McpClient.cs index c4abe33..f63f4b4 100644 --- a/src/ModelContextProtocol.Core/Client/McpClient.cs +++ b/src/ModelContextProtocol.Core/Client/McpClient.cs @@ -41,8 +41,8 @@ public abstract partial class McpClient : McpSession, IMcpClient /// tools, expected input formats, limitations, or any other helpful information. /// /// - /// This can be used by clients to improve an LLM's understanding of available tools, prompts, and resources. - /// It can be thought of like a "hint" to the model and may be added to a system prompt. + /// This can be used by clients to improve an LLM's understanding of available tools, prompts, and resources. + /// It can be thought of like a "hint" to the model and can be added to a system prompt. /// /// public abstract string? ServerInstructions { get; } diff --git a/src/ModelContextProtocol.Core/Client/McpClientExtensions.cs b/src/ModelContextProtocol.Core/Client/McpClientExtensions.cs index de2d007..4f46b74 100644 --- a/src/ModelContextProtocol.Core/Client/McpClientExtensions.cs +++ b/src/ModelContextProtocol.Core/Client/McpClientExtensions.cs @@ -11,11 +11,9 @@ namespace ModelContextProtocol.Client; /// Provides extension methods for interacting with an . /// /// -/// /// This class contains extension methods that simplify common operations with an MCP client, /// such as pinging a server, listing and working with tools, prompts, and resources, and /// managing subscriptions to resources. -/// /// public static class McpClientExtensions { @@ -28,7 +26,7 @@ public static class McpClientExtensions /// /// /// This method is used to check if the MCP server is online and responding to requests. - /// It can be useful for health checking, ensuring the connection is established, or verifying + /// It can be useful for health checking, ensuring the connection is established, or verifying /// that the client has proper authorization to communicate with the server. /// /// @@ -37,7 +35,7 @@ public static class McpClientExtensions /// /// /// is . - /// Thrown when the server cannot be reached or returns an error response. + /// The server cannot be reached or returned an error response. [Obsolete($"Use {nameof(McpClient)}.{nameof(McpClient.PingAsync)} instead. This member will be removed in a subsequent release.")] // See: https://github.com/modelcontextprotocol/csharp-sdk/issues/774 [EditorBrowsable(EditorBrowsableState.Never)] public static Task PingAsync(this IMcpClient client, CancellationToken cancellationToken = default) @@ -47,7 +45,7 @@ public static class McpClientExtensions /// Retrieves a list of available tools from the server. /// /// The client instance used to communicate with the MCP server. - /// The serializer options governing tool parameter serialization. If null, the default options will be used. + /// The serializer options governing tool parameter serialization. If null, the default options are used. /// The to monitor for cancellation requests. The default is . /// A list of all available tools as instances. /// @@ -56,8 +54,8 @@ public static class McpClientExtensions /// It automatically handles pagination with cursors if the server responds with only a portion per request. /// /// - /// For servers with a large number of tools and that responds with paginated responses, consider using - /// instead, as it streams tools as they arrive rather than loading them all at once. + /// For servers with a large number of tools and that responds with paginated responses, consider using + /// instead, because it streams tools as they arrive rather than loading them all at once. /// /// /// The serializer options provided are flowed to each and will be used @@ -68,13 +66,13 @@ public static class McpClientExtensions /// /// // Get all tools available on the server /// var tools = await mcpClient.ListToolsAsync(); - /// + /// /// // Use tools with an AI client /// ChatOptions chatOptions = new() /// { /// Tools = [.. tools] /// }; - /// + /// /// await foreach (var update in chatClient.GetStreamingResponseAsync(userMessage, chatOptions)) /// { /// Console.Write(update); @@ -94,7 +92,7 @@ public static class McpClientExtensions /// Creates an enumerable for asynchronously enumerating all available tools from the server. /// /// The client instance used to communicate with the MCP server. - /// The serializer options governing tool parameter serialization. If null, the default options will be used. + /// The serializer options governing tool parameter serialization. If null, the default options are used. /// The to monitor for cancellation requests. The default is . /// An asynchronous sequence of all available tools as instances. /// @@ -105,7 +103,7 @@ public static class McpClientExtensions /// /// /// The serializer options provided are flowed to each and will be used - /// when invoking tools in order to serialize any parameters. + /// when invoking tools to serialize any parameters. /// /// /// Every iteration through the returned @@ -142,7 +140,7 @@ public static class McpClientExtensions /// It automatically handles pagination with cursors if the server responds with only a portion per request. /// /// - /// For servers with a large number of prompts and that responds with paginated responses, consider using + /// For servers with a large number of prompts and that responds with paginated responses, consider using /// instead, as it streams prompts as they arrive rather than loading them all at once. /// /// @@ -201,7 +199,7 @@ public static class McpClientExtensions /// The server will process the arguments and return a prompt containing messages or other content. /// /// - /// Arguments are serialized into JSON and passed to the server, where they may be used to customize the + /// Arguments are serialized into JSON and passed to the server, where they may be used to customize the /// prompt's behavior or content. Each prompt may have different argument requirements. /// /// @@ -233,7 +231,7 @@ public static class McpClientExtensions /// It automatically handles pagination with cursors if the server responds with only a portion per request. /// /// - /// For servers with a large number of resource templates and that responds with paginated responses, consider using + /// For servers with a large number of resource templates and that responds with paginated responses, consider using /// instead, as it streams templates as they arrive rather than loading them all at once. /// /// @@ -289,7 +287,7 @@ public static class McpClientExtensions /// It automatically handles pagination with cursors if the server responds with only a portion per request. /// /// - /// For servers with a large number of resources and that responds with paginated responses, consider using + /// For servers with a large number of resources and that responds with paginated responses, consider using /// instead, as it streams resources as they arrive rather than loading them all at once. /// /// @@ -297,7 +295,7 @@ public static class McpClientExtensions /// /// // Get all resources available on the server /// var resources = await client.ListResourcesAsync(); - /// + /// /// // Display information about each resource /// foreach (var resource in resources) /// { @@ -410,7 +408,7 @@ public static class McpClientExtensions /// auto-completion in user interfaces. /// /// - /// When working with resource references, the server will return suggestions relevant to the specified + /// When working with resource references, the server will return suggestions relevant to the specified /// resource URI. /// /// @@ -554,7 +552,7 @@ public static class McpClientExtensions /// routed to this instance. /// /// - /// The JSON serialization options governing argument serialization. If , the default serialization options will be used. + /// The JSON serialization options governing argument serialization. If , the default serialization options are used. /// /// The to monitor for cancellation requests. The default is . /// @@ -607,4 +605,4 @@ public static class McpClientExtensions $"'{nameof(McpClientExtensions)}.{memberName}' is obsolete and will be " + $"removed in the future."); } -} \ No newline at end of file +} diff --git a/src/ModelContextProtocol.Core/Client/McpClientHandlers.cs b/src/ModelContextProtocol.Core/Client/McpClientHandlers.cs index f6abf0d..56e12d2 100644 --- a/src/ModelContextProtocol.Core/Client/McpClientHandlers.cs +++ b/src/ModelContextProtocol.Core/Client/McpClientHandlers.cs @@ -26,7 +26,7 @@ public class McpClientHandlers /// Gets or sets notification handlers to register with the client. /// /// - /// When constructed, the client will enumerate these handlers once, which may contain multiple handlers per notification method key. + /// When constructed, the client will enumerate these handlers, which might contain multiple handlers per notification method key, once. /// The client will not re-enumerate the sequence after initialization. /// /// @@ -36,7 +36,7 @@ public class McpClientHandlers /// /// /// Handlers provided via will be registered with the client for the lifetime of the client. - /// For transient handlers, may be used to register a handler that can + /// For transient handlers, you can use to register a handler that can /// then be unregistered by disposing of the returned from the method. /// /// @@ -75,8 +75,8 @@ public class McpClientHandlers /// using an AI model. The client must set this property for the sampling capability to work. /// /// - /// The handler receives message parameters, a progress reporter for updates, and a - /// cancellation token. It should return a containing the + /// The handler receives message parameters, a progress reporter for updates, and a + /// cancellation token. It should return a containing the /// generated content. /// /// diff --git a/src/ModelContextProtocol.Core/Client/McpClientOptions.cs b/src/ModelContextProtocol.Core/Client/McpClientOptions.cs index 6225393..36ec3b2 100644 --- a/src/ModelContextProtocol.Core/Client/McpClientOptions.cs +++ b/src/ModelContextProtocol.Core/Client/McpClientOptions.cs @@ -20,7 +20,7 @@ public sealed class McpClientOptions /// It's often displayed in server logs and can be used for debugging and compatibility checks. /// /// - /// When not specified, information sourced from the current process will be used. + /// When not specified, information sourced from the current process is used. /// /// public Implementation? ClientInfo { get; set; } @@ -35,7 +35,7 @@ public sealed class McpClientOptions /// /// /// - /// The protocol version is a key part of the initialization handshake. The client and server must + /// The protocol version is a key part of the initialization handshake. The client and server must /// agree on a compatible protocol version to communicate successfully. /// /// @@ -50,25 +50,27 @@ public sealed class McpClientOptions /// /// Gets or sets a timeout for the client-server initialization handshake sequence. /// + /// + /// The timeout for the client-server initialization handshake sequence. The default value is 60 seconds. + /// /// /// /// This timeout determines how long the client will wait for the server to respond during /// the initialization protocol handshake. If the server doesn't respond within this timeframe, - /// an exception will be thrown. + /// an exception is thrown. /// /// /// Setting an appropriate timeout prevents the client from hanging indefinitely when /// connecting to unresponsive servers. /// - /// The default value is 60 seconds. /// public TimeSpan InitializationTimeout { get; set; } = TimeSpan.FromSeconds(60); /// /// Gets or sets the container of handlers used by the client for processing protocol messages. /// - public McpClientHandlers Handlers - { + public McpClientHandlers Handlers + { get => field ??= new(); set { diff --git a/src/ModelContextProtocol.Core/Client/McpClientPrompt.cs b/src/ModelContextProtocol.Core/Client/McpClientPrompt.cs index c84e078..354cd31 100644 --- a/src/ModelContextProtocol.Core/Client/McpClientPrompt.cs +++ b/src/ModelContextProtocol.Core/Client/McpClientPrompt.cs @@ -30,17 +30,16 @@ public sealed class McpClientPrompt /// /// /// This constructor enables reusing cached prompt definitions across different instances - /// without needing to call on every reconnect. This is particularly useful + /// without needing to call on every reconnect. This is particularly useful /// in scenarios where prompt definitions are stable and network round-trips should be minimized. /// /// - /// The provided must represent a prompt that is actually available on the server - /// associated with the . Attempting to invoke a prompt that doesn't exist on the + /// The provided must represent a prompt that is actually available on the server + /// associated with the . Attempting to invoke a prompt that doesn't exist on the /// server will result in an . /// /// - /// is . - /// is . + /// or is . public McpClientPrompt(McpClient client, Prompt prompt) { Throw.IfNull(client); @@ -57,7 +56,7 @@ public sealed class McpClientPrompt /// which can be useful for advanced scenarios or when implementing custom MCP client extensions. /// /// - /// For most common use cases, you can use the more convenient and + /// For most common use cases, you can use the more convenient and /// properties instead of accessing the directly. /// /// @@ -69,7 +68,7 @@ public sealed class McpClientPrompt /// Gets the title of the prompt. public string? Title => ProtocolPrompt.Title; - /// Gets a description of the prompt. + /// Gets the description of the prompt. public string? Description => ProtocolPrompt.Description; /// @@ -85,7 +84,7 @@ public sealed class McpClientPrompt /// The server will process the request and return a result containing messages or other content. /// /// - /// This is a convenience method that internally calls + /// This is a convenience method that internally calls /// with this prompt's name and arguments. /// /// @@ -100,4 +99,4 @@ public sealed class McpClientPrompt return await _client.GetPromptAsync(ProtocolPrompt.Name, argDict, serializerOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } -} \ No newline at end of file +} diff --git a/src/ModelContextProtocol.Core/Client/McpClientResource.cs b/src/ModelContextProtocol.Core/Client/McpClientResource.cs index 504eca0..fe3fb1c 100644 --- a/src/ModelContextProtocol.Core/Client/McpClientResource.cs +++ b/src/ModelContextProtocol.Core/Client/McpClientResource.cs @@ -25,17 +25,16 @@ public sealed class McpClientResource /// /// /// This constructor enables reusing cached resource definitions across different instances - /// without needing to call on every reconnect. This is particularly useful + /// without needing to call on every reconnect. This is particularly useful /// in scenarios where resource definitions are stable and network round-trips should be minimized. /// /// - /// The provided must represent a resource that is actually available on the server - /// associated with the . Attempting to read a resource that doesn't exist on the + /// The provided must represent a resource that is actually available on the server + /// associated with the . Attempting to read a resource that doesn't exist on the /// server will result in an . /// /// - /// is . - /// is . + /// or is . public McpClientResource(McpClient client, Resource resource) { Throw.IfNull(client); @@ -52,7 +51,7 @@ public sealed class McpClientResource /// which can be useful for advanced scenarios or when implementing custom MCP client extensions. /// /// - /// For most common use cases, you can use the more convenient and + /// For most common use cases, you can use the more convenient and /// properties instead of accessing the directly. /// /// @@ -67,10 +66,10 @@ public sealed class McpClientResource /// Gets the title of the resource. public string? Title => ProtocolResource.Title; - /// Gets a description of the resource. + /// Gets the description of the resource. public string? Description => ProtocolResource.Description; - /// Gets a media (MIME) type of the resource. + /// Gets the media (MIME) type of the resource. public string? MimeType => ProtocolResource.MimeType; /// @@ -86,4 +85,4 @@ public sealed class McpClientResource public ValueTask ReadAsync( CancellationToken cancellationToken = default) => _client.ReadResourceAsync(Uri, cancellationToken); -} \ No newline at end of file +} diff --git a/src/ModelContextProtocol.Core/Client/McpClientResourceTemplate.cs b/src/ModelContextProtocol.Core/Client/McpClientResourceTemplate.cs index 134cef5..ddbdfe1 100644 --- a/src/ModelContextProtocol.Core/Client/McpClientResourceTemplate.cs +++ b/src/ModelContextProtocol.Core/Client/McpClientResourceTemplate.cs @@ -25,17 +25,16 @@ public sealed class McpClientResourceTemplate /// /// /// This constructor enables reusing cached resource template definitions across different instances - /// without needing to call on every reconnect. This is particularly useful + /// without needing to call on every reconnect. This is particularly useful /// in scenarios where resource template definitions are stable and network round-trips should be minimized. /// /// - /// The provided must represent a resource template that is actually available on the server - /// associated with the . Attempting to read a resource template that doesn't exist on the + /// The provided must represent a resource template that is actually available on the server + /// associated with the . Attempting to read a resource template that doesn't exist on the /// server will result in an . /// /// - /// is . - /// is . + /// or is . public McpClientResourceTemplate(McpClient client, ResourceTemplate resourceTemplate) { Throw.IfNull(client); @@ -52,7 +51,7 @@ public sealed class McpClientResourceTemplate /// which can be useful for advanced scenarios or when implementing custom MCP client extensions. /// /// - /// For most common use cases, you can use the more convenient and + /// For most common use cases, you can use the more convenient and /// properties instead of accessing the directly. /// /// @@ -67,10 +66,10 @@ public sealed class McpClientResourceTemplate /// Gets the title of the resource template. public string? Title => ProtocolResourceTemplate.Title; - /// Gets a description of the resource template. + /// Gets the description of the resource template. public string? Description => ProtocolResourceTemplate.Description; - /// Gets a media (MIME) type of the resource template. + /// Gets the media (MIME) type of the resource template. public string? MimeType => ProtocolResourceTemplate.MimeType; /// @@ -86,4 +85,4 @@ public sealed class McpClientResourceTemplate IReadOnlyDictionary arguments, CancellationToken cancellationToken = default) => _client.ReadResourceAsync(UriTemplate, arguments, cancellationToken); -} \ No newline at end of file +} diff --git a/src/ModelContextProtocol.Core/Client/McpClientTool.cs b/src/ModelContextProtocol.Core/Client/McpClientTool.cs index 012bc81..d076082 100644 --- a/src/ModelContextProtocol.Core/Client/McpClientTool.cs +++ b/src/ModelContextProtocol.Core/Client/McpClientTool.cs @@ -10,7 +10,7 @@ namespace ModelContextProtocol.Client; /// /// /// -/// The class encapsulates an along with a description of +/// The class encapsulates an along with a description of /// a tool available via that client, allowing it to be invoked as an . This enables integration /// with AI models that support function calling capabilities. /// @@ -43,23 +43,22 @@ public sealed class McpClientTool : AIFunction /// The instance to use for invoking the tool. /// The protocol definition describing the tool's metadata and schema. /// - /// The JSON serialization options governing argument serialization. If , - /// will be used. + /// The JSON serialization options governing argument serialization. If , + /// is used. /// /// /// /// This constructor enables reusing cached tool definitions across different instances - /// without needing to call on every reconnect. This is particularly useful + /// without needing to call on every reconnect. This is particularly useful /// in scenarios where tool definitions are stable and network round-trips should be minimized. /// /// - /// The provided must represent a tool that is actually available on the server - /// associated with the . Attempting to invoke a tool that doesn't exist on the + /// The provided must represent a tool that is actually available on the server + /// associated with the . Attempting to invoke a tool that doesn't exist on the /// server will result in an . /// /// - /// is . - /// is . + /// or is . public McpClientTool( McpClient client, Tool tool, @@ -165,23 +164,23 @@ public sealed class McpClientTool : AIFunction /// routed to this instance. /// /// - /// The JSON serialization options governing argument serialization. If , the default serialization options will be used. + /// The JSON serialization options governing argument serialization. If , the default serialization options are used. /// /// The to monitor for cancellation requests. The default is . /// /// A task containing the from the tool execution. The response includes - /// the tool's output content, which may be structured data, text, or an error message. + /// the tool's output content, which can be structured data, text, or an error message. /// /// /// The base method is overridden to invoke this method. - /// The only difference in behavior is will serialize the resulting "/> + /// The only difference in behavior is that serializes the resulting "/> /// such that the returned is a containing the serialized . /// This method is intended to be called directly by user code, whereas the base /// is intended to be used polymorphically via the base class, typically as part of an operation. /// /// The server could not find the requested tool, or the server encountered an error while processing the request. /// - /// + /// /// var result = await tool.CallAsync( /// new Dictionary<string, object?> /// { @@ -203,23 +202,24 @@ public sealed class McpClientTool : AIFunction /// A new instance of with the provided name. /// /// - /// This is useful for optimizing the tool name for specific models or for prefixing the tool name + /// This method is useful for optimizing the tool name for specific models or for prefixing the tool name /// with a namespace to avoid conflicts. /// /// /// Changing the name can help with: /// /// - /// Making the tool name more intuitive for the model - /// Preventing name collisions when using tools from multiple sources - /// Creating specialized versions of a general tool for specific contexts + /// Making the tool name more intuitive for the model. + /// Preventing name collisions when using tools from multiple sources. + /// Creating specialized versions of a general tool for specific contexts. /// /// - /// When invoking , the MCP server will still be called with + /// When invoking , the MCP server will still be called with /// the original tool name, so no mapping is required on the server side. This new name only affects /// the value returned from this instance's . /// /// + /// A new instance of with the provided name. public McpClientTool WithName(string name) => new(_client, ProtocolTool, JsonSerializerOptions, name, _description, _progress); @@ -233,12 +233,12 @@ public sealed class McpClientTool : AIFunction /// context about how the tool should be used. This is particularly useful when: /// /// - /// The original description is too technical or lacks clarity for the model - /// You want to add example usage scenarios to improve the model's understanding - /// You need to tailor the tool's description for specific model requirements + /// The original description is too technical or lacks clarity for the model. + /// You want to add example usage scenarios to improve the model's understanding. + /// You need to tailor the tool's description for specific model requirements. /// /// - /// When invoking , the MCP server will still be called with + /// When invoking , the MCP server will still be called with /// the original tool description, so no mapping is required on the server side. This new description only affects /// the value returned from this instance's . /// @@ -260,7 +260,7 @@ public sealed class McpClientTool : AIFunction /// /// /// Only one can be specified at a time. Calling again - /// will overwrite any previously specified progress instance. + /// overwrites any previously specified progress instance. /// /// /// A new instance of , configured with the provided progress instance. @@ -270,4 +270,4 @@ public sealed class McpClientTool : AIFunction return new McpClientTool(_client, ProtocolTool, JsonSerializerOptions, _name, _description, progress); } -} \ No newline at end of file +} diff --git a/src/ModelContextProtocol.Core/Client/StdioClientTransport.cs b/src/ModelContextProtocol.Core/Client/StdioClientTransport.cs index 55483b6..edb8124 100644 --- a/src/ModelContextProtocol.Core/Client/StdioClientTransport.cs +++ b/src/ModelContextProtocol.Core/Client/StdioClientTransport.cs @@ -38,7 +38,7 @@ public sealed partial class StdioClientTransport : IClientTransport /// Initializes a new instance of the class. /// /// Configuration options for the transport, including the command to execute, arguments, working directory, and environment variables. - /// Logger factory for creating loggers used for diagnostic output during transport operations. + /// A logger factory for creating loggers used for diagnostic output during transport operations. public StdioClientTransport(StdioClientTransportOptions options, ILoggerFactory? loggerFactory = null) { Throw.IfNull(options); @@ -91,7 +91,7 @@ public sealed partial class StdioClientTransport : IClientTransport #endif }; - if (arguments is not null) + if (arguments is not null) { #if NET foreach (string arg in arguments) @@ -234,7 +234,7 @@ public sealed partial class StdioClientTransport : IClientTransport } } - /// Gets whether has exited. + /// Gets a value that indicates whether has exited. internal static bool HasExited(Process process) { try diff --git a/src/ModelContextProtocol.Core/Client/StdioClientTransportOptions.cs b/src/ModelContextProtocol.Core/Client/StdioClientTransportOptions.cs index 5930e9d..94425eb 100644 --- a/src/ModelContextProtocol.Core/Client/StdioClientTransportOptions.cs +++ b/src/ModelContextProtocol.Core/Client/StdioClientTransportOptions.cs @@ -43,7 +43,7 @@ public sealed class StdioClientTransportOptions /// /// /// This property allows you to specify environment variables that will be set in the server process's - /// environment. This is useful for passing configuration, authentication information, or runtime flags + /// environment. Setting these variables is useful for passing configuration, authentication information, or runtime flags /// to the server without modifying its code. /// /// @@ -58,15 +58,15 @@ public sealed class StdioClientTransportOptions /// /// Gets or sets the timeout to wait for the server to shut down gracefully. /// + /// + /// The amount of time to wait for the server to shut down gracefully. The default is 5 seconds. + /// /// /// /// This property dictates how long the client should wait for the server process to exit cleanly during shutdown - /// before forcibly terminating it. This balances between giving the server enough time to clean up + /// before forcibly terminating it. This balances giving the server enough time to clean up /// resources and not hanging indefinitely if a server process becomes unresponsive. /// - /// - /// The default is five seconds. - /// /// public TimeSpan ShutdownTimeout { get; set; } = TimeSpan.FromSeconds(5); diff --git a/src/ModelContextProtocol.Core/Client/StreamClientSessionTransport.cs b/src/ModelContextProtocol.Core/Client/StreamClientSessionTransport.cs index dfcccf6..c896bd4 100644 --- a/src/ModelContextProtocol.Core/Client/StreamClientSessionTransport.cs +++ b/src/ModelContextProtocol.Core/Client/StreamClientSessionTransport.cs @@ -31,7 +31,7 @@ internal class StreamClientSessionTransport : TransportBase /// A name that identifies this transport endpoint in logs. /// /// - /// Optional factory for creating loggers. If null, a NullLogger will be used. + /// Optional factory for creating loggers. If null, a NullLogger is used. /// /// /// This constructor starts a background task to read messages from the server output stream. @@ -73,7 +73,7 @@ internal class StreamClientSessionTransport : TransportBase /// A name that identifies this transport endpoint in logs. /// /// - /// Optional factory for creating loggers. If null, a NullLogger will be used. + /// Optional factory for creating loggers. If null, a NullLogger is used. /// /// /// This constructor starts a background task to read messages from the server output stream. diff --git a/src/ModelContextProtocol.Core/McpEndpointExtensions.cs b/src/ModelContextProtocol.Core/McpEndpointExtensions.cs index 1a5b5c1..160b31c 100644 --- a/src/ModelContextProtocol.Core/McpEndpointExtensions.cs +++ b/src/ModelContextProtocol.Core/McpEndpointExtensions.cs @@ -13,7 +13,7 @@ namespace ModelContextProtocol; /// /// /// -/// This class provides strongly-typed methods for working with the Model Context Protocol (MCP) endpoints, +/// This class provides strongly typed methods for working with the Model Context Protocol (MCP) endpoints, /// simplifying JSON-RPC communication by handling serialization and deserialization of parameters and results. /// /// @@ -30,8 +30,8 @@ public static class McpEndpointExtensions /// The type of the result to deserialize to. /// The MCP client or server instance. /// The JSON-RPC method name to invoke. - /// Object representing the request parameters. - /// The request id for the request. + /// The request parameters. + /// The request ID for the request. /// 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. @@ -56,8 +56,8 @@ public static class McpEndpointExtensions /// A task that represents the asynchronous send operation. /// /// - /// This method sends a notification without any parameters. Notifications are one-way messages - /// that don't expect a response. They are commonly used for events, status updates, or to signal + /// This method sends a notification without any parameters. Notifications are one-way messages + /// that don't expect a response. They are commonly used for events, status updates, or to signal /// changes in state. /// /// @@ -78,11 +78,11 @@ public static class McpEndpointExtensions /// A task that represents the asynchronous send operation. /// /// - /// This method sends a notification with parameters to the connected endpoint. Notifications are one-way + /// This method sends a notification with parameters to the connected endpoint. Notifications are one-way /// messages that don't expect a response, commonly used for events, status updates, or signaling changes. /// /// - /// The parameters object is serialized to JSON according to the provided serializer options or the default + /// The parameters object is serialized to JSON according to the provided serializer options or the default /// options if none are specified. /// /// diff --git a/src/ModelContextProtocol.Core/McpErrorCode.cs b/src/ModelContextProtocol.Core/McpErrorCode.cs index 11d03eb..58e7dbf 100644 --- a/src/ModelContextProtocol.Core/McpErrorCode.cs +++ b/src/ModelContextProtocol.Core/McpErrorCode.cs @@ -37,13 +37,13 @@ public enum McpErrorCode /// This error is returned for protocol-level parameter issues, such as: /// /// - /// Malformed requests that fail to satisfy the request schema (e.g., CallToolRequest) - /// Unknown or unrecognized primitive names (e.g., tool, prompt, or resource names) + /// Malformed requests that fail to satisfy the request schema (for example, CallToolRequest) + /// Unknown or unrecognized primitive names (for example, tool, prompt, or resource names) /// Missing required protocol-level parameters /// /// /// Note: Input validation errors within tool/prompt/resource arguments should be reported as execution errors - /// (e.g., via ) rather than as protocol errors, allowing language + /// (for example, via ) rather than as protocol errors, allowing language /// models to receive error feedback and self-correct. /// /// diff --git a/src/ModelContextProtocol.Core/McpException.cs b/src/ModelContextProtocol.Core/McpException.cs index 71b1bc3..5abdb04 100644 --- a/src/ModelContextProtocol.Core/McpException.cs +++ b/src/ModelContextProtocol.Core/McpException.cs @@ -6,7 +6,7 @@ namespace ModelContextProtocol; /// Represents an exception that is thrown when an Model Context Protocol (MCP) error occurs. /// /// -/// The from a may be propagated to the remote +/// The from a might be propagated to the remote /// endpoint; sensitive information should not be included. If sensitive details need to be included, /// a different exception type should be used. /// diff --git a/src/ModelContextProtocol.Core/McpProtocolException.cs b/src/ModelContextProtocol.Core/McpProtocolException.cs index c6e6ba0..0f223e0 100644 --- a/src/ModelContextProtocol.Core/McpProtocolException.cs +++ b/src/ModelContextProtocol.Core/McpProtocolException.cs @@ -16,7 +16,7 @@ namespace ModelContextProtocol; /// . /// /// -/// or from a may be +/// or from a may be /// propagated to the remote endpoint; sensitive information should not be included. If sensitive details need /// to be included, a different exception type should be used. /// @@ -51,7 +51,7 @@ public sealed class McpProtocolException : McpException /// Initializes a new instance of the class with a specified error message and JSON-RPC error code. /// /// The message that describes the error. - /// A . + /// An . public McpProtocolException(string message, McpErrorCode errorCode) : this(message, null, errorCode) { } @@ -61,7 +61,7 @@ public sealed class McpProtocolException : McpException /// /// The message that describes the error. /// The exception that is the cause of the current exception, or a null reference if no inner exception is specified. - /// A . + /// An . public McpProtocolException(string message, Exception? innerException, McpErrorCode errorCode) : base(message, innerException) { ErrorCode = errorCode; @@ -81,4 +81,4 @@ public sealed class McpProtocolException : McpException /// /// public McpErrorCode ErrorCode { get; } = McpErrorCode.InternalError; -} \ No newline at end of file +} diff --git a/src/ModelContextProtocol.Core/McpSession.Methods.cs b/src/ModelContextProtocol.Core/McpSession.Methods.cs index c537732..be3128c 100644 --- a/src/ModelContextProtocol.Core/McpSession.Methods.cs +++ b/src/ModelContextProtocol.Core/McpSession.Methods.cs @@ -15,8 +15,8 @@ public abstract partial class McpSession : IMcpEndpoint, IAsyncDisposable /// The type of the request parameters to serialize from. /// The type of the result to deserialize to. /// The JSON-RPC method name to invoke. - /// Object representing the request parameters. - /// The request id for the request. + /// The request parameters. + /// The request ID for the request. /// 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. @@ -42,10 +42,10 @@ public abstract partial class McpSession : IMcpEndpoint, IAsyncDisposable /// The type of the request parameters to serialize from. /// The type of the result to deserialize to. /// The JSON-RPC method name to invoke. - /// Object representing the request parameters. + /// The request parameters. /// The type information for request parameter serialization. /// The type information for request parameter deserialization. - /// The request id for the request. + /// The request ID for the request. /// The to monitor for cancellation requests. The default is . /// A task that represents the asynchronous operation. The task result contains the deserialized result. internal async ValueTask SendRequestAsync( @@ -80,8 +80,8 @@ public abstract partial class McpSession : IMcpEndpoint, IAsyncDisposable /// A task that represents the asynchronous send operation. /// /// - /// This method sends a notification without any parameters. Notifications are one-way messages - /// that don't expect a response. They are commonly used for events, status updates, or to signal + /// This method sends a notification without any parameters. Notifications are one-way messages + /// that don't expect a response. They are commonly used for events, status updates, or to signal /// changes in state. /// /// @@ -96,17 +96,17 @@ public abstract partial class McpSession : IMcpEndpoint, IAsyncDisposable /// /// The type of the notification parameters to serialize. /// The JSON-RPC method name for the notification. - /// Object representing the notification parameters. + /// The notification parameters. /// The options governing parameter serialization. If null, default options are used. /// The to monitor for cancellation requests. The default is . /// A task that represents the asynchronous send operation. /// /// - /// This method sends a notification with parameters to the connected session. Notifications are one-way + /// This method sends a notification with parameters to the connected session. Notifications are one-way /// messages that don't expect a response, commonly used for events, status updates, or signaling changes. /// /// - /// The parameters object is serialized to JSON according to the provided serializer options or the default + /// The parameters object is serialized to JSON according to the provided serializer options or the default /// options if none are specified. /// /// @@ -131,7 +131,7 @@ public abstract partial class McpSession : IMcpEndpoint, IAsyncDisposable /// Sends a notification to the server with parameters. /// /// The JSON-RPC method name to invoke. - /// Object representing the request parameters. + /// The request parameters. /// The type information for request parameter serialization. /// The to monitor for cancellation requests. The default is . internal Task SendNotificationAsync( @@ -150,7 +150,7 @@ public abstract partial class McpSession : IMcpEndpoint, IAsyncDisposable /// /// Notifies the connected session of progress for a long-running operation. /// - /// The identifying the operation for which progress is being reported. + /// The token that identifies the operation for which progress is being reported. /// The progress update to send, containing information such as percentage complete or status message. /// The to monitor for cancellation requests. The default is . /// A task representing the completion of the notification operation (not the operation being tracked). diff --git a/src/ModelContextProtocol.Core/McpSession.cs b/src/ModelContextProtocol.Core/McpSession.cs index 429fdbf..acc6df5 100644 --- a/src/ModelContextProtocol.Core/McpSession.cs +++ b/src/ModelContextProtocol.Core/McpSession.cs @@ -17,9 +17,9 @@ namespace ModelContextProtocol; /// /// /// -/// serves as the base interface for both and -/// interfaces, providing the common functionality needed for MCP protocol -/// communication. Most applications will use these more specific interfaces rather than working with +/// serves as the base interface for both and +/// interfaces, providing the common functionality needed for MCP protocol +/// communication. Most applications will use these more specific interfaces rather than working with /// directly. /// /// @@ -32,7 +32,7 @@ public abstract partial class McpSession : IMcpEndpoint, IAsyncDisposable { /// Gets an identifier associated with the current MCP session. /// - /// Typically populated in transports supporting multiple sessions such as Streamable HTTP or SSE. + /// Typically populated in transports supporting multiple sessions, such as Streamable HTTP or SSE. /// Can return if the session hasn't initialized or if the transport doesn't /// support multiple sessions (as is the case with STDIO). /// @@ -53,7 +53,7 @@ public abstract partial class McpSession : IMcpEndpoint, IAsyncDisposable /// The JSON-RPC request to send. /// The to monitor for cancellation requests. The default is . /// A task containing the session's response. - /// The transport is not connected, or another error occurs during request processing. + /// The transport is not connected, or another error occurred during request processing. /// An error occurred during request processing. /// /// This method provides low-level access to send raw JSON-RPC requests. For most use cases, @@ -79,7 +79,7 @@ public abstract partial class McpSession : IMcpEndpoint, IAsyncDisposable /// on this class that provide a simpler API. /// /// - /// The method will serialize the message and transmit it using the underlying transport mechanism. + /// The method serializes the message and transmits it using the underlying transport mechanism. /// /// public abstract Task SendMessageAsync(JsonRpcMessage message, CancellationToken cancellationToken = default); diff --git a/src/ModelContextProtocol.Core/ProgressNotificationValue.cs b/src/ModelContextProtocol.Core/ProgressNotificationValue.cs index 68ac73b..def9f62 100644 --- a/src/ModelContextProtocol.Core/ProgressNotificationValue.cs +++ b/src/ModelContextProtocol.Core/ProgressNotificationValue.cs @@ -1,10 +1,12 @@ namespace ModelContextProtocol; -/// Provides a progress value that can be sent using . +/// +/// Provides a progress value that can be sent using . +/// public sealed class ProgressNotificationValue { /// - /// Gets or sets the progress thus far. + /// Gets or initializes the progress thus far. /// /// /// @@ -18,9 +20,9 @@ public sealed class ProgressNotificationValue /// public required float Progress { get; init; } - /// Gets or sets the total number of items to process (or total progress required), if known. + /// Gets or initializes the total number of items to process (or total progress required), if known. public float? Total { get; init; } - /// Gets or sets an optional message describing the current progress. + /// Gets or initializes an optional message describing the current progress. public string? Message { get; init; } } diff --git a/src/ModelContextProtocol.Core/Server/McpMetaAttribute.cs b/src/ModelContextProtocol.Core/Server/McpMetaAttribute.cs index ad631ae..a70c26c 100644 --- a/src/ModelContextProtocol.Core/Server/McpMetaAttribute.cs +++ b/src/ModelContextProtocol.Core/Server/McpMetaAttribute.cs @@ -6,7 +6,7 @@ using System.Text.Json.Nodes; namespace ModelContextProtocol.Server; /// -/// Used to specify metadata for an MCP server primitive (tool, prompt, or resource). +/// Specifies metadata for an MCP server primitive (tool, prompt, or resource). /// /// /// @@ -24,7 +24,7 @@ namespace ModelContextProtocol.Server; /// /// /// -/// +/// /// [McpServerTool] /// [McpMeta("model", "gpt-4o")] /// [McpMeta("version", "1.0")] @@ -60,10 +60,10 @@ public sealed class McpMetaAttribute : Attribute } /// - /// Initializes a new instance of the class with a boolean value. + /// Initializes a new instance of the class with a Boolean value. /// /// The name (key) of the metadata entry. - /// The boolean value of the metadata entry. + /// The Boolean value of the metadata entry. public McpMetaAttribute(string name, bool value) { Name = name; @@ -85,16 +85,16 @@ public sealed class McpMetaAttribute : Attribute /// /// /// This value must be well-formed JSON. It will be parsed and added to the metadata . - /// Simple values can be represented as JSON literals like "\"my-string\"", "123", - /// "true", etc. Complex structures can be represented as JSON objects or arrays. + /// Simple values can be represented as JSON literals like "\"my-string\"", "123", + /// or "true". Complex structures can be represented as JSON objects or arrays. /// /// - /// Setting this property will override any value provided via the constructor. + /// Setting this property overrides any value provided via the constructor. /// /// /// For programmatic scenarios where you want to construct complex metadata without dealing with - /// JSON strings, use the , - /// , or + /// JSON strings, use the , + /// , or /// property to provide a JsonObject directly. /// /// diff --git a/src/ModelContextProtocol.Core/Server/McpServer.Methods.cs b/src/ModelContextProtocol.Core/Server/McpServer.Methods.cs index 3b0eadf..604f215 100644 --- a/src/ModelContextProtocol.Core/Server/McpServer.Methods.cs +++ b/src/ModelContextProtocol.Core/Server/McpServer.Methods.cs @@ -28,13 +28,12 @@ public abstract partial class McpServer : McpSession, IMcpServer /// /// Creates a new instance of an . /// - /// Transport to use for the server representing an already-established MCP session. + /// The transport to use for the server representing an already-established MCP session. /// Configuration options for this server, including capabilities. /// Logger factory to use for logging. If null, logging will be disabled. /// Optional service provider to create new instances of tools and other dependencies. /// An instance that should be disposed when no longer needed. - /// is . - /// is . + /// or is . public static McpServer Create( ITransport transport, McpServerOptions serverOptions, @@ -207,7 +206,7 @@ public abstract partial class McpServer : McpSession, IMcpServer } /// Gets an on which logged messages will be sent as notifications to the client. - /// An that can be used to log to the client.. + /// An that can be used to log to the client. public ILoggerProvider AsClientLoggerProvider() { return new ClientLoggerProvider(this); @@ -341,7 +340,7 @@ public abstract partial class McpServer : McpSession, IMcpServer /// The type to create the schema for. /// The serializer options to use. /// The created primitive schema definition. - /// Thrown when the type is not supported. + /// The type is not supported. private static ElicitRequestParams.PrimitiveSchemaDefinition CreatePrimitiveSchema(Type type, JsonSerializerOptions serializerOptions) { if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>)) diff --git a/src/ModelContextProtocol.Core/Server/McpServerFilters.cs b/src/ModelContextProtocol.Core/Server/McpServerFilters.cs index d68b349..334e132 100644 --- a/src/ModelContextProtocol.Core/Server/McpServerFilters.cs +++ b/src/ModelContextProtocol.Core/Server/McpServerFilters.cs @@ -12,7 +12,7 @@ namespace ModelContextProtocol.Server; public sealed class McpServerFilters { /// - /// Gets the filters for the list tools handler pipeline. + /// Gets the filters for the list-tools handler pipeline. /// /// /// @@ -29,7 +29,7 @@ public sealed class McpServerFilters public List> ListToolsFilters { get; } = []; /// - /// Gets the filters for the call tool handler pipeline. + /// Gets the filters for the call-tool handler pipeline. /// /// /// These filters wrap handlers that are invoked when a client makes a call to a tool that isn't found in the collection. @@ -39,7 +39,7 @@ public sealed class McpServerFilters public List> CallToolFilters { get; } = []; /// - /// Gets the filters for the list prompts handler pipeline. + /// Gets the filters for the list-prompts handler pipeline. /// /// /// @@ -56,7 +56,7 @@ public sealed class McpServerFilters public List> ListPromptsFilters { get; } = []; /// - /// Gets the filters for the get prompt handler pipeline. + /// Gets the filters for the get-prompt handler pipeline. /// /// /// These filters wrap handlers that are invoked when a client requests details for a specific prompt that isn't found in the collection. @@ -66,7 +66,7 @@ public sealed class McpServerFilters public List> GetPromptFilters { get; } = []; /// - /// Gets the filters for the list resource templates handler pipeline. + /// Gets the filters for the list-resource-templates handler pipeline. /// /// /// These filters wrap handlers that return a list of available resource templates when requested by a client. @@ -77,7 +77,7 @@ public sealed class McpServerFilters public List> ListResourceTemplatesFilters { get; } = []; /// - /// Gets the filters for the list resources handler pipeline. + /// Gets the filters for the list-resources handler pipeline. /// /// /// These filters wrap handlers that return a list of available resources when requested by a client. @@ -88,7 +88,7 @@ public sealed class McpServerFilters public List> ListResourcesFilters { get; } = []; /// - /// Gets the filters for the read resource handler pipeline. + /// Gets the filters for the read-resource handler pipeline. /// /// /// These filters wrap handlers that are invoked when a client requests the content of a specific resource identified by its URI. @@ -98,7 +98,7 @@ public sealed class McpServerFilters public List> ReadResourceFilters { get; } = []; /// - /// Gets the filters for the complete handler pipeline. + /// Gets the filters for the complete-handler pipeline. /// /// /// These filters wrap handlers that provide auto-completion suggestions for prompt arguments or resource references in the Model Context Protocol. @@ -109,7 +109,7 @@ public sealed class McpServerFilters public List> CompleteFilters { get; } = []; /// - /// Gets the filters for the subscribe to resources handler pipeline. + /// Gets the filters for the subscribe-to-resources handler pipeline. /// /// /// @@ -126,7 +126,7 @@ public sealed class McpServerFilters public List> SubscribeToResourcesFilters { get; } = []; /// - /// Gets the filters for the unsubscribe from resources handler pipeline. + /// Gets the filters for the unsubscribe-from-resources handler pipeline. /// /// /// @@ -143,7 +143,7 @@ public sealed class McpServerFilters public List> UnsubscribeFromResourcesFilters { get; } = []; /// - /// Gets the filters for the set logging level handler pipeline. + /// Gets the filters for the set-logging-level handler pipeline. /// /// /// diff --git a/src/ModelContextProtocol.Core/Server/McpServerHandlers.cs b/src/ModelContextProtocol.Core/Server/McpServerHandlers.cs index 0d8deba..77102ac 100644 --- a/src/ModelContextProtocol.Core/Server/McpServerHandlers.cs +++ b/src/ModelContextProtocol.Core/Server/McpServerHandlers.cs @@ -159,7 +159,7 @@ public sealed class McpServerHandlers /// Gets or sets notification handlers to register with the server. /// /// - /// When constructed, the server will enumerate these handlers once, which may contain multiple handlers per notification method key. + /// When constructed, the server will enumerate these handlers, which may contain multiple handlers per notification method key, once. /// The server will not re-enumerate the sequence after initialization. /// /// diff --git a/src/ModelContextProtocol.Core/Server/McpServerOptions.cs b/src/ModelContextProtocol.Core/Server/McpServerOptions.cs index 7b915b9..937e288 100644 --- a/src/ModelContextProtocol.Core/Server/McpServerOptions.cs +++ b/src/ModelContextProtocol.Core/Server/McpServerOptions.cs @@ -21,7 +21,7 @@ public sealed class McpServerOptions /// /// /// These determine which features will be available when a client connects. - /// Capabilities can include "tools", "prompts", "resources", "logging", and other + /// Capabilities can include "tools", "prompts", "resources", "logging", and other /// protocol-specific functionality. /// public ServerCapabilities? Capabilities { get; set; } @@ -61,12 +61,12 @@ public sealed class McpServerOptions public string? ServerInstructions { get; set; } /// - /// Gets or sets whether to create a new service provider scope for each handled request. + /// Gets or sets a value that indicates whether to create a new service provider scope for each handled request. /// - /// - /// The default is . When , each invocation of a request - /// handler will be invoked within a new service scope. - /// + /// + /// if each invocation of a request handler is invoked within a new service scope. + /// The default is . + /// public bool ScopeRequests { get; set; } = true; /// @@ -84,8 +84,8 @@ public sealed class McpServerOptions /// Gets the filter collections for MCP server handlers. /// /// - /// This property provides access to filter collections that can be used to modify the behavior - /// of various MCP server handlers. Filters are applied in reverse order, so the last filter + /// This property provides access to filter collections that can be used to modify the behavior + /// of various MCP server handlers. Filters are applied in reverse order, so the last filter /// added will be the outermost (first to execute). /// public McpServerFilters Filters { get; } = new(); @@ -93,12 +93,12 @@ public sealed class McpServerOptions /// /// Gets or sets the container of handlers used by the server for processing protocol messages. /// - public McpServerHandlers Handlers - { + public McpServerHandlers Handlers + { get => field ??= new(); set - { - Throw.IfNull(value); + { + Throw.IfNull(value); field = value; } } @@ -143,7 +143,7 @@ public sealed class McpServerOptions /// when those are provided: /// /// - /// - For requests: The server returns all prompts from this collection + /// - For requests: The server returns all prompts from this collection /// plus any additional prompts provided by the if it's set. /// /// @@ -156,14 +156,12 @@ public sealed class McpServerOptions /// /// Gets or sets the default maximum number of tokens to use for sampling requests when not explicitly specified. /// + /// + /// The default maximum number of tokens to use for sampling requests. The default value is 1000 tokens. + /// /// - /// /// This value is used in /// when is not set in the request options. - /// - /// - /// The default value is 1000 tokens. - /// /// public int MaxSamplingOutputTokens { get; set; } = 1000; } diff --git a/src/ModelContextProtocol.Core/Server/McpServerPrimitiveCollection.cs b/src/ModelContextProtocol.Core/Server/McpServerPrimitiveCollection.cs index a618877..96a3495 100644 --- a/src/ModelContextProtocol.Core/Server/McpServerPrimitiveCollection.cs +++ b/src/ModelContextProtocol.Core/Server/McpServerPrimitiveCollection.cs @@ -5,7 +5,7 @@ using System.Diagnostics.CodeAnalysis; namespace ModelContextProtocol.Server; /// Provides a thread-safe collection of instances, indexed by their names. -/// Specifies the type of primitive stored in the collection. +/// The type of primitive stored in the collection. public class McpServerPrimitiveCollection : ICollection, IReadOnlyCollection where T : IMcpServerPrimitive { @@ -22,15 +22,15 @@ public class McpServerPrimitiveCollection : ICollection, IReadOnlyCollecti /// Occurs when the collection is changed. /// - /// By default, this is raised when a primitive is added or removed. However, a derived implementation - /// may raise this event for other reasons, such as when a primitive is modified. + /// By default, this event is raised when a primitive is added or removed. However, a derived implementation + /// might raise this event for other reasons, such as when a primitive is modified. /// public event EventHandler? Changed; /// Gets the number of primitives in the collection. public int Count => _primitives.Count; - /// Gets whether there are any primitives in the collection. + /// Gets a value that indicates whether there are any primitives in the collection. public bool IsEmpty => _primitives.IsEmpty; /// Raises if there are registered handlers. @@ -86,10 +86,10 @@ public class McpServerPrimitiveCollection : ICollection, IReadOnlyCollecti return added; } - /// Removes the specified primitivefrom the collection. + /// Removes the specified primitive from the collection. /// The primitive to be removed from the collection. /// - /// if the primitive was found in the collection and removed; otherwise, if it couldn't be found. + /// if the primitive was found in the collection and removed; if it wasn't found. /// /// is . public virtual bool Remove(T primitive) @@ -109,7 +109,7 @@ public class McpServerPrimitiveCollection : ICollection, IReadOnlyCollecti /// The name of the primitive to retrieve. /// The primitive, if found; otherwise, . /// - /// if the primitive was found in the collection and return; otherwise, if it couldn't be found. + /// if the primitive was found in the collection and returned; if it wasn't found. /// /// is . public virtual bool TryGetPrimitive(string name, [NotNullWhen(true)] out T? primitive) @@ -120,7 +120,7 @@ public class McpServerPrimitiveCollection : ICollection, IReadOnlyCollecti /// Checks if a specific primitive is present in the collection of primitives. /// The primitive to search for in the collection. - /// if the primitive was found in the collection and return; otherwise, if it couldn't be found. + /// if the primitive was found in the collection and returned; if it wasn't found. /// is . public virtual bool Contains(T primitive) { @@ -160,4 +160,4 @@ public class McpServerPrimitiveCollection : ICollection, IReadOnlyCollecti /// bool ICollection.IsReadOnly => false; -} \ No newline at end of file +} diff --git a/src/ModelContextProtocol.Core/Server/McpServerPromptAttribute.cs b/src/ModelContextProtocol.Core/Server/McpServerPromptAttribute.cs index 1dcf7bc..3b5e061 100644 --- a/src/ModelContextProtocol.Core/Server/McpServerPromptAttribute.cs +++ b/src/ModelContextProtocol.Core/Server/McpServerPromptAttribute.cs @@ -10,7 +10,7 @@ namespace ModelContextProtocol.Server; /// /// /// -/// This attribute is applied to methods that should be exposed as prompts in the Model Context Protocol. When a class +/// This attribute is applied to methods that should be exposed as prompts in the Model Context Protocol. When a class /// containing methods marked with this attribute is registered with McpServerBuilderExtensions, /// these methods become available as prompts that can be called by MCP clients. /// @@ -52,15 +52,15 @@ namespace ModelContextProtocol.Server; /// /// /// -/// When the is constructed, it may be passed an via +/// When the is constructed, it may be passed an via /// . Any parameter that can be satisfied by that -/// according to will be resolved from the provided to the +/// according to will be resolved from the provided to the /// prompt invocation rather than from the argument collection. /// /// /// /// -/// Any parameter attributed with will similarly be resolved from the +/// Any parameter attributed with will similarly be resolved from the /// provided to the prompt invocation rather than from the argument collection. /// /// @@ -71,7 +71,7 @@ namespace ModelContextProtocol.Server; /// /// /// In general, the data supplied via the 's dictionary is passed along from the caller and -/// should thus be considered unvalidated and untrusted. To provide validated and trusted data to the invocation of the prompt, consider having +/// should thus be considered unvalidated and untrusted. To provide validated and trusted data to the invocation of the prompt, consider having /// the prompt be an instance method, referring to data stored in the instance, or using an instance or parameters resolved from the /// to provide data to the method. /// @@ -114,8 +114,8 @@ public sealed class McpServerPromptAttribute : Attribute { } - /// Gets the name of the prompt. - /// If , the method name will be used. + /// Gets or sets the name of the prompt. + /// If , the method name is used. public string? Name { get; set; } /// Gets or sets the title of the prompt. @@ -126,7 +126,7 @@ public sealed class McpServerPromptAttribute : Attribute /// /// /// - /// This can be an HTTP/HTTPS URL pointing to an image file or a data URI with base64-encoded image data. + /// This value can be an HTTP/HTTPS URL pointing to an image file or a data URI with base64-encoded image data. /// When specified, a single icon will be added to the prompt. /// /// diff --git a/src/ModelContextProtocol.Core/Server/McpServerPromptCreateOptions.cs b/src/ModelContextProtocol.Core/Server/McpServerPromptCreateOptions.cs index 752af49..83b6cb8 100644 --- a/src/ModelContextProtocol.Core/Server/McpServerPromptCreateOptions.cs +++ b/src/ModelContextProtocol.Core/Server/McpServerPromptCreateOptions.cs @@ -36,7 +36,7 @@ public sealed class McpServerPromptCreateOptions /// /// /// If , but an is applied to the method, - /// the name from the attribute will be used. If that's not present, a name based on the method's name will be used. + /// the name from the attribute is used. If that's not present, a name based on the method's name is used. /// public string? Name { get; set; } @@ -50,7 +50,7 @@ public sealed class McpServerPromptCreateOptions /// /// /// If , but a is applied to the method, - /// the description from that attribute will be used. + /// the description from that attribute is used. /// public string? Description { get; set; } @@ -63,7 +63,7 @@ public sealed class McpServerPromptCreateOptions public JsonSerializerOptions? SerializerOptions { get; set; } /// - /// Gets or sets the JSON schema options when creating from a method. + /// Gets or sets the JSON schema options when creating an from a method. /// /// /// Defaults to if left unspecified. @@ -83,7 +83,7 @@ public sealed class McpServerPromptCreateOptions /// Gets or sets the icons for this prompt. /// /// - /// This can be used by clients to display the prompt's icon in a user interface. + /// This property can be used by clients to display the prompt's icon in a user interface. /// public IList? Icons { get; set; } diff --git a/src/ModelContextProtocol.Core/Server/McpServerPromptTypeAttribute.cs b/src/ModelContextProtocol.Core/Server/McpServerPromptTypeAttribute.cs index 4fc38a5..18e5989 100644 --- a/src/ModelContextProtocol.Core/Server/McpServerPromptTypeAttribute.cs +++ b/src/ModelContextProtocol.Core/Server/McpServerPromptTypeAttribute.cs @@ -1,12 +1,12 @@ namespace ModelContextProtocol.Server; /// -/// Used to attribute a type containing methods that should be exposed as s. +/// Specifies that a type contains methods that should be exposed as s. /// /// /// /// This attribute is used to mark a class containing methods that should be automatically -/// discovered and registered as s. When combined with discovery methods like +/// discovered and registered as prompts. When combined with discovery methods like /// WithPromptsFromAssembly, it enables automatic registration of prompts without explicitly listing each prompt class. /// The attribute is not necessary when a reference to the type is provided directly to a method like WithPrompts. /// diff --git a/src/ModelContextProtocol.Core/Server/McpServerResource.cs b/src/ModelContextProtocol.Core/Server/McpServerResource.cs index 991c907..4441b43 100644 --- a/src/ModelContextProtocol.Core/Server/McpServerResource.cs +++ b/src/ModelContextProtocol.Core/Server/McpServerResource.cs @@ -25,8 +25,8 @@ namespace ModelContextProtocol.Server; /// into the that's then serialized and sent back to the client. /// /// -/// is used to represent both direct resources (e.g. "resource://example") and templated -/// resources (e.g. "resource://example/{id}"). +/// is used to represent both direct resources (for example,"resource://example") and templated +/// resources (for example,"resource://example/{id}"). /// /// /// Read resource requests do not contain separate arguments, only a URI. However, for templated resources, portions of that URI may be considered @@ -129,7 +129,7 @@ public abstract class McpServerResource : IMcpServerPrimitive { } - /// Gets whether this resource is a URI template with parameters as opposed to a direct resource. + /// Gets a value that indicates whether this resource is a URI template with parameters as opposed to a direct resource. public bool IsTemplated => ProtocolResourceTemplate.UriTemplate.Contains('{'); /// Gets the protocol type for this instance. @@ -140,7 +140,7 @@ public abstract class McpServerResource : IMcpServerPrimitive /// /// /// Every valid resource URI is a valid resource URI template, and thus this property always returns an instance. - /// In contrast, the property may return if the resource template + /// In contrast, the property might return if the resource template /// contains a parameter, in which case the resource template URI is not a valid resource URI. /// /// @@ -224,12 +224,12 @@ public abstract class McpServerResource : IMcpServerPrimitive /// /// Creates an instance for a method, specified via an for - /// and instance method, along with a representing the type of the target object to + /// an instance method, along with a representing the type of the target object to /// instantiate each time the method is invoked. /// /// The instance method to be represented via the created . /// - /// Callback used on each function invocation to create an instance of the type on which the instance method + /// The callback used on each function invocation to create an instance of the type on which the instance method /// will be invoked. If the returned instance is or , it will /// be disposed of after method completes its invocation. /// diff --git a/src/ModelContextProtocol.Core/Server/McpServerResourceAttribute.cs b/src/ModelContextProtocol.Core/Server/McpServerResourceAttribute.cs index 8639a0b..7d10545 100644 --- a/src/ModelContextProtocol.Core/Server/McpServerResourceAttribute.cs +++ b/src/ModelContextProtocol.Core/Server/McpServerResourceAttribute.cs @@ -5,11 +5,11 @@ using ModelContextProtocol.Protocol; namespace ModelContextProtocol.Server; /// -/// Used to indicate that a method or property should be considered an . +/// Indicates that a method or property should be considered an . /// /// /// -/// This attribute is applied to methods or properties that should be exposed as resources in the Model Context Protocol. When a class +/// This attribute is applied to methods or properties that should be exposed as resources in the Model Context Protocol. When a class /// containing methods marked with this attribute is registered with McpServerBuilderExtensions, /// these methods or properties become available as resources that can be called by MCP clients. /// @@ -50,15 +50,15 @@ namespace ModelContextProtocol.Server; /// /// /// -/// When the is constructed, it may be passed an via +/// When the is constructed, it may be passed an via /// . Any parameter that can be satisfied by that -/// according to will be resolved from the provided to the +/// according to will be resolved from the provided to the /// resource invocation rather than from the argument collection. /// /// /// /// -/// Any parameter attributed with will similarly be resolved from the +/// Any parameter attributed with will similarly be resolved from the /// provided to the resource invocation rather than from the argument collection. /// /// @@ -119,15 +119,15 @@ public sealed class McpServerResourceAttribute : Attribute /// Gets or sets the URI template of the resource. /// /// If , a URI will be derived from and the method's parameter names. - /// This template may, but doesn't have to, include parameters; if it does, this - /// will be considered a "resource template", and if it doesn't, it will be considered a "direct resource". + /// This template can, but doesn't have to, include parameters; if it does, this + /// is considered a "resource template", and if it doesn't, it is considered a "direct resource". /// The former will be listed with requests and the latter /// with requests. /// public string? UriTemplate { get; set; } /// Gets or sets the name of the resource. - /// If , the method name will be used. + /// If , the method name is used. public string? Name { get; set; } /// Gets or sets the title of the resource. diff --git a/src/ModelContextProtocol.Core/Server/McpServerResourceCreateOptions.cs b/src/ModelContextProtocol.Core/Server/McpServerResourceCreateOptions.cs index 34a08a1..9ea70b4 100644 --- a/src/ModelContextProtocol.Core/Server/McpServerResourceCreateOptions.cs +++ b/src/ModelContextProtocol.Core/Server/McpServerResourceCreateOptions.cs @@ -36,7 +36,7 @@ public sealed class McpServerResourceCreateOptions /// /// /// If , but an is applied to the member, - /// the from the attribute will be used. If that's not present, + /// the from the attribute is used. If that's not present, /// a URI template will be inferred from the member's signature. /// public string? UriTemplate { get; set; } @@ -46,7 +46,7 @@ public sealed class McpServerResourceCreateOptions /// /// /// If , but an is applied to the member, - /// the name from the attribute will be used. If that's not present, a name based on the members's name will be used. + /// the name from the attribute is used. If that's not present, a name based on the members's name is used. /// public string? Name { get; set; } @@ -60,7 +60,7 @@ public sealed class McpServerResourceCreateOptions /// /// /// If , but a is applied to the member, - /// the description from that attribute will be used. + /// the description from that attribute is used. /// public string? Description { get; set; } @@ -72,17 +72,17 @@ public sealed class McpServerResourceCreateOptions /// /// Gets or sets the JSON serializer options to use when marshalling data to/from JSON. /// - /// - /// Defaults to if left unspecified. - /// + /// + /// The default is . + /// public JsonSerializerOptions? SerializerOptions { get; set; } /// /// Gets or sets the JSON schema options when creating from a method. /// - /// - /// Defaults to if left unspecified. - /// + /// + /// The default is . + /// public AIJsonSchemaCreateOptions? SchemaCreateOptions { get; set; } /// @@ -98,7 +98,7 @@ public sealed class McpServerResourceCreateOptions /// Gets or sets the icons for this resource. /// /// - /// This can be used by clients to display the resource's icon in a user interface. + /// This property can be used by clients to display the resource's icon in a user interface. /// public IList? Icons { get; set; } @@ -109,7 +109,7 @@ public sealed class McpServerResourceCreateOptions /// /// This is used to seed the property. Any metadata from /// instances on the method will be added to this object, but - /// properties already present in this will not be overwritten. + /// properties already present in this are not overwritten. /// /// /// Implementations must not make assumptions about its contents. diff --git a/src/ModelContextProtocol.Core/Server/McpServerResourceTypeAttribute.cs b/src/ModelContextProtocol.Core/Server/McpServerResourceTypeAttribute.cs index 4d549af..c441bb2 100644 --- a/src/ModelContextProtocol.Core/Server/McpServerResourceTypeAttribute.cs +++ b/src/ModelContextProtocol.Core/Server/McpServerResourceTypeAttribute.cs @@ -1,13 +1,13 @@ namespace ModelContextProtocol.Server; /// -/// Used to attribute a type containing members that should be exposed as s. +/// Indicates that a type contains members that should be exposed as s. /// /// /// /// This attribute is used to mark a class containing members that should be automatically /// discovered and registered as s. When combined with discovery methods like -/// WithResourcesFromAssembly, it enables automatic registration of resources without explicitly listing each +/// WithResourcesFromAssembly, it enables automatic registration of resources without explicitly listing each /// resource class. The attribute is not necessary when a reference to the type is provided directly to a method /// like McpServerBuilderExtensions.WithResources. /// diff --git a/src/ModelContextProtocol.Core/Server/McpServerTool.cs b/src/ModelContextProtocol.Core/Server/McpServerTool.cs index 987424b..4c0a4fb 100644 --- a/src/ModelContextProtocol.Core/Server/McpServerTool.cs +++ b/src/ModelContextProtocol.Core/Server/McpServerTool.cs @@ -184,7 +184,7 @@ public abstract class McpServerTool : IMcpServerPrimitive /// /// Creates an instance for a method, specified via an for - /// and instance method, along with a representing the type of the target object to + /// an instance method, along with a representing the type of the target object to /// instantiate each time the method is invoked. /// /// The instance method to be represented via the created . diff --git a/src/ModelContextProtocol.Core/Server/McpServerToolAttribute.cs b/src/ModelContextProtocol.Core/Server/McpServerToolAttribute.cs index cf54555..834e3e4 100644 --- a/src/ModelContextProtocol.Core/Server/McpServerToolAttribute.cs +++ b/src/ModelContextProtocol.Core/Server/McpServerToolAttribute.cs @@ -6,11 +6,11 @@ using System.Text.Json; namespace ModelContextProtocol.Server; /// -/// Used to indicate that a method should be considered an . +/// Indicates that a method should be considered an . /// /// /// -/// This attribute is applied to methods that should be exposed as tools in the Model Context Protocol. When a class +/// This attribute is applied to methods that should be exposed as tools in the Model Context Protocol. When a class /// containing methods marked with this attribute is registered with McpServerBuilderExtensions, /// these methods become available as tools that can be called by MCP clients. /// @@ -47,22 +47,22 @@ namespace ModelContextProtocol.Server; /// /// parameters accepting values /// are not included in the JSON schema and are bound to an instance manufactured -/// to forward progress notifications from the tool to the client. If the client included a in their request, +/// to forward progress notifications from the tool to the client. If the client included a in their request, /// progress reports issued to this instance will propagate to the client as notifications with /// that token. If the client did not include a , the instance will ignore any progress reports issued to it. /// /// /// /// -/// When the is constructed, it may be passed an via +/// When the is constructed, it may be passed an via /// . Any parameter that can be satisfied by that -/// according to will not be included in the generated JSON schema and will be resolved +/// according to will not be included in the generated JSON schema and will be resolved /// from the provided to when the tool is invoked rather than from the argument collection. /// /// /// /// -/// Any parameter attributed with will similarly be resolved from the +/// Any parameter attributed with will similarly be resolved from the /// provided when the tool is invoked rather than from the argument /// collection, and will not be included in the generated JSON schema. /// @@ -70,13 +70,13 @@ namespace ModelContextProtocol.Server; /// /// /// -/// All other parameters are deserialized from the s in the dictionary, -/// using the supplied in , or if none was provided, +/// All other parameters are deserialized from the s in the dictionary, +/// using the supplied in , or if none was provided, /// using . /// /// /// In general, the data supplied via the 's dictionary is passed along from the caller and -/// should thus be considered unvalidated and untrusted. To provide validated and trusted data to the invocation of the tool, consider having +/// should thus be considered unvalidated and untrusted. To provide validated and trusted data to the invocation of the tool, consider having /// the tool be an instance method, referring to data stored in the instance, or using an instance or parameters resolved from the /// to provide data to the method. /// @@ -145,7 +145,7 @@ public sealed class McpServerToolAttribute : Attribute } /// Gets the name of the tool. - /// If , the method name will be used. + /// If , the method name is used. public string? Name { get; set; } /// @@ -165,93 +165,81 @@ public sealed class McpServerToolAttribute : Attribute public string? Title { get; set; } /// - /// Gets or sets whether the tool may perform destructive updates to its environment. + /// Gets or sets a value that indicates whether the tool might perform destructive updates to its environment. /// - /// - /// - /// If , the tool may perform destructive updates to its environment. - /// If , the tool performs only additive updates. - /// This property is most relevant when the tool modifies its environment (ReadOnly = false). - /// - /// + /// + /// if the tool might perform destructive updates to its environment. + /// if the tool performs only additive updates. /// The default is . - /// + /// + /// + /// This property is most relevant when the tool modifies its environment (ReadOnly = false). /// - public bool Destructive + public bool Destructive { - get => _destructive ?? DestructiveDefault; - set => _destructive = value; + get => _destructive ?? DestructiveDefault; + set => _destructive = value; } /// - /// Gets or sets whether calling the tool repeatedly with the same arguments - /// will have no additional effect on its environment. + /// Gets or sets a value that indicates whether calling the tool repeatedly with the same arguments + /// has no additional effect on its environment. /// - /// - /// - /// This property is most relevant when the tool modifies its environment (ReadOnly = false). - /// - /// + /// + /// if calling the tool repeatedly with the same arguments + /// has no additional effect on the environment; if it does. /// The default is . - /// + /// + /// + /// This property is most relevant when the tool modifies its environment (ReadOnly = false). /// - public bool Idempotent + public bool Idempotent { get => _idempotent ?? IdempotentDefault; - set => _idempotent = value; + set => _idempotent = value; } /// - /// Gets or sets whether this tool may interact with an "open world" of external entities. + /// Gets or sets a value that indicates whether this tool can interact with an "open world" of external entities. /// - /// - /// - /// If , the tool may interact with an unpredictable or dynamic set of entities (like web search). - /// If , the tool's domain of interaction is closed and well-defined (like memory access). - /// - /// + /// + /// if the tool can interact with an unpredictable or dynamic set of entities (like web search). + /// if the tool's domain of interaction is closed and well-defined (like memory access). /// The default is . - /// - /// + /// public bool OpenWorld { - get => _openWorld ?? OpenWorldDefault; - set => _openWorld = value; + get => _openWorld ?? OpenWorldDefault; + set => _openWorld = value; } /// - /// Gets or sets whether this tool does not modify its environment. + /// Gets or sets a value that indicates whether this tool does not modify its environment. /// + /// + /// if the tool only performs read operations without changing state. + /// if the tool might make modifications to its environment. + /// The default is . + /// /// - /// - /// If , the tool only performs read operations without changing state. - /// If , the tool may make modifications to its environment. - /// - /// /// Read-only tools do not have side effects beyond computational resource usage. /// They don't create, update, or delete data in any system. - /// - /// - /// The default is . - /// /// - public bool ReadOnly + public bool ReadOnly { - get => _readOnly ?? ReadOnlyDefault; - set => _readOnly = value; + get => _readOnly ?? ReadOnlyDefault; + set => _readOnly = value; } /// - /// Gets or sets whether the tool should report an output schema for structured content. + /// Gets or sets a value that indicates whether the tool should report an output schema for structured content. /// + /// + /// The default is . + /// /// - /// /// When enabled, the tool will attempt to populate the /// and provide structured content in the property. - /// - /// - /// The default is . - /// /// public bool UseStructuredContent { get; set; } @@ -260,7 +248,7 @@ public sealed class McpServerToolAttribute : Attribute /// /// /// - /// This can be an HTTP/HTTPS URL pointing to an image file or a data URI with base64-encoded image data. + /// This value can be an HTTP/HTTPS URL pointing to an image file or a data URI with base64-encoded image data. /// When specified, a single icon will be added to the tool. /// /// diff --git a/src/ModelContextProtocol.Core/Server/McpServerToolCreateOptions.cs b/src/ModelContextProtocol.Core/Server/McpServerToolCreateOptions.cs index b029e5d..6e2241b 100644 --- a/src/ModelContextProtocol.Core/Server/McpServerToolCreateOptions.cs +++ b/src/ModelContextProtocol.Core/Server/McpServerToolCreateOptions.cs @@ -36,7 +36,7 @@ public sealed class McpServerToolCreateOptions /// /// /// If , but an is applied to the method, - /// the name from the attribute will be used. If that's not present, a name based on the method's name will be used. + /// the name from the attribute is used. If that's not present, a name based on the method's name is used. /// public string? Name { get; set; } @@ -45,7 +45,7 @@ public sealed class McpServerToolCreateOptions /// /// /// If , but a is applied to the method, - /// the description from that attribute will be used. + /// the description from that attribute is used. /// public string? Description { get; set; } @@ -66,94 +66,82 @@ public sealed class McpServerToolCreateOptions public string? Title { get; set; } /// - /// Gets or sets whether the tool may perform destructive updates to its environment. + /// Gets or sets a value that indicates whether the tool might perform destructive updates to its environment. /// - /// - /// - /// If , the tool may perform destructive updates to its environment. - /// If , the tool performs only additive updates. - /// This property is most relevant when the tool modifies its environment (ReadOnly = false). - /// - /// + /// + /// if the tool might perform destructive updates to its environment. + /// if the tool performs only additive updates. /// The default is . - /// + /// + /// + /// This property is most relevant when the tool modifies its environment (ReadOnly = false). /// public bool? Destructive { get; set; } /// - /// Gets or sets whether calling the tool repeatedly with the same arguments - /// will have no additional effect on its environment. + /// Gets or sets a value that indicates whether calling the tool repeatedly with the same arguments + /// has no additional effect on its environment. /// - /// - /// - /// This property is most relevant when the tool modifies its environment (ReadOnly = false). - /// - /// + /// + /// if calling the tool repeatedly with the same arguments + /// has no additional effect on the environment; if it does. /// The default is . - /// + /// + /// + /// This property is most relevant when the tool modifies its environment (ReadOnly = false). /// public bool? Idempotent { get; set; } /// - /// Gets or sets whether this tool may interact with an "open world" of external entities. + /// Gets or sets a value that indicates whether this tool can interact with an "open world" of external entities. /// - /// - /// - /// If , the tool may interact with an unpredictable or dynamic set of entities (like web search). - /// If , the tool's domain of interaction is closed and well-defined (like memory access). - /// - /// + /// + /// if the tool can interact with an unpredictable or dynamic set of entities (like web search). + /// if the tool's domain of interaction is closed and well-defined (like memory access). /// The default is . - /// - /// + /// public bool? OpenWorld { get; set; } /// - /// Gets or sets whether this tool does not modify its environment. + /// Gets or sets a value that indicates whether this tool does not modify its environment. /// - /// - /// + /// /// If , the tool only performs read operations without changing state. - /// If , the tool may make modifications to its environment. - /// - /// + /// If , the tool might make modifications to its environment. + /// The default is . + /// + /// /// Read-only tools do not have side effects beyond computational resource usage. /// They don't create, update, or delete data in any system. - /// - /// - /// The default is . - /// /// public bool? ReadOnly { get; set; } /// - /// Gets or sets whether the tool should report an output schema for structured content. + /// Gets or sets a value that indicates whether the tool should report an output schema for structured content. /// + /// + /// The default is . + /// /// - /// /// When enabled, the tool will attempt to populate the /// and provide structured content in the property. - /// - /// - /// The default is . - /// /// public bool UseStructuredContent { get; set; } /// /// Gets or sets the JSON serializer options to use when marshalling data to/from JSON. /// - /// - /// Defaults to if left unspecified. - /// + /// + /// The default is . + /// public JsonSerializerOptions? SerializerOptions { get; set; } /// - /// Gets or sets the JSON schema options when creating from a method. + /// Gets or sets the JSON schema options when creating an from a method. /// - /// - /// Defaults to if left unspecified. - /// + /// + /// The default is . + /// public AIJsonSchemaCreateOptions? SchemaCreateOptions { get; set; } /// @@ -169,7 +157,7 @@ public sealed class McpServerToolCreateOptions /// Gets or sets the icons for this tool. /// /// - /// This can be used by clients to display the tool's icon in a user interface. + /// This property can be used by clients to display the tool's icon in a user interface. /// public IList? Icons { get; set; } diff --git a/src/ModelContextProtocol.Core/Server/McpServerToolTypeAttribute.cs b/src/ModelContextProtocol.Core/Server/McpServerToolTypeAttribute.cs index 8eff125..d806f08 100644 --- a/src/ModelContextProtocol.Core/Server/McpServerToolTypeAttribute.cs +++ b/src/ModelContextProtocol.Core/Server/McpServerToolTypeAttribute.cs @@ -1,7 +1,7 @@ namespace ModelContextProtocol.Server; /// -/// Used to attribute a type containing methods that should be exposed as s. +/// Indicates that a type contains methods that should be exposed as s. /// /// /// diff --git a/src/ModelContextProtocol.Core/Server/RequestContext.cs b/src/ModelContextProtocol.Core/Server/RequestContext.cs index 1240e37..6f1bc85 100644 --- a/src/ModelContextProtocol.Core/Server/RequestContext.cs +++ b/src/ModelContextProtocol.Core/Server/RequestContext.cs @@ -10,7 +10,7 @@ namespace ModelContextProtocol.Server; /// /// The encapsulates all contextual information for handling an MCP request. /// This type is typically received as a parameter in handler delegates registered with IMcpServerBuilder, -/// and may be injected as parameters into s. +/// and can be injected as parameters into s. /// public sealed class RequestContext { @@ -55,7 +55,7 @@ public sealed class RequestContext /// Gets or sets the services associated with this request. /// - /// This may not be the same instance stored in + /// This provider might not be the same instance stored in /// if was true, in which case this /// might be a scoped derived from the server's /// . @@ -81,4 +81,4 @@ public sealed class RequestContext /// including the method name, parameters, request ID, and associated transport and user information. /// public JsonRpcRequest JsonRpcRequest { get; } -} \ No newline at end of file +} diff --git a/src/ModelContextProtocol.Core/Server/SseResponseStreamTransport.cs b/src/ModelContextProtocol.Core/Server/SseResponseStreamTransport.cs index 9815521..5d73152 100644 --- a/src/ModelContextProtocol.Core/Server/SseResponseStreamTransport.cs +++ b/src/ModelContextProtocol.Core/Server/SseResponseStreamTransport.cs @@ -76,7 +76,7 @@ public sealed class SseResponseStreamTransport(Stream sseResponseStream, string? /// The JSON-RPC message received from the client. /// The to monitor for cancellation requests. The default is . /// A task representing the asynchronous operation to buffer the JSON-RPC message for processing. - /// Thrown when there is an attempt to process a message before calling . + /// There is an attempt to process a message before calling . /// /// /// This method is the entry point for processing client-to-server communication in the SSE transport model. diff --git a/src/ModelContextProtocol.Core/Server/StreamServerTransport.cs b/src/ModelContextProtocol.Core/Server/StreamServerTransport.cs index 915d781..7747d7f 100644 --- a/src/ModelContextProtocol.Core/Server/StreamServerTransport.cs +++ b/src/ModelContextProtocol.Core/Server/StreamServerTransport.cs @@ -36,8 +36,7 @@ public class StreamServerTransport : TransportBase /// The output to use as standard output. /// Optional name of the server, used for diagnostic purposes, like logging. /// Optional logger factory used for logging employed by the transport. - /// is . - /// is . + /// or is . public StreamServerTransport(Stream inputStream, Stream outputStream, string? serverName = null, ILoggerFactory? loggerFactory = null) : base(serverName is not null ? $"Server (stream) ({serverName})" : "Server (stream)", loggerFactory) { diff --git a/src/ModelContextProtocol.Core/Server/StreamableHttpServerTransport.cs b/src/ModelContextProtocol.Core/Server/StreamableHttpServerTransport.cs index ee943ea..8a64094 100644 --- a/src/ModelContextProtocol.Core/Server/StreamableHttpServerTransport.cs +++ b/src/ModelContextProtocol.Core/Server/StreamableHttpServerTransport.cs @@ -41,21 +41,21 @@ public sealed class StreamableHttpServerTransport : ITransport public string? SessionId { get; set; } /// - /// Configures whether the transport should be in stateless mode that does not require all requests for a given session + /// Gets or initializes a value that indicates whether the transport should be in stateless mode that does not require all requests for a given session /// to arrive to the same ASP.NET Core application process. Unsolicited server-to-client messages are not supported in this mode, /// so calling results in an . - /// Server-to-client requests are also unsupported, because the responses may arrive at another ASP.NET Core application process. + /// Server-to-client requests are also unsupported, because the responses might arrive at another ASP.NET Core application process. /// Client sampling and roots capabilities are also disabled in stateless mode, because the server cannot make requests. /// public bool Stateless { get; init; } /// - /// Gets a value indicating whether the execution context should flow from the calls to + /// Gets or initializes a value indicating whether the execution context should flow from the calls to /// to the corresponding property contained in the instances returned by the . /// - /// - /// Defaults to . - /// + /// + /// The default is . + /// public bool FlowExecutionContextFromRequests { get; init; } /// @@ -103,14 +103,14 @@ public sealed class StreamableHttpServerTransport : ITransport /// This token allows for the operation to be canceled if needed. The default is . /// The POST response body to write MCP JSON-RPC messages to. /// - /// True, if data was written to the response body. - /// False, if nothing was written because the request body did not contain any messages to respond to. + /// if data was written to the response body. + /// if nothing was written because the request body did not contain any messages to respond to. /// The HTTP application should typically respond with an empty "202 Accepted" response in this scenario. /// - /// - /// If 's an authenticated sent the message, that can be included in the . + /// + /// If an authenticated sent the message, that can be included in the . /// No other part of the context should be set. - /// + /// public async Task HandlePostRequestAsync(JsonRpcMessage message, Stream responseStream, CancellationToken cancellationToken = default) { Throw.IfNull(message);