AI seeded comments from robch and then edited by stephentoub (#238)

* AI generated `///` comment updates

* Fix compilation issues

* Fix incorrect XML comment structure

* Update all Client comments

* Update all Configuration comments

* Update all Messages comments

* Update all Transport comments

* Update all Types comments

* Update all Server comments

* Undo some commenting

---------

Co-authored-by: Stephen Toub <stoub@microsoft.com>
This commit is contained in:
Rob Chambers 2025-04-09 22:30:44 -07:00 • committed by GitHub
commit 77871c5aac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,82 +1,105 @@
namespace ModelContextProtocol.Protocol.Messages;
namespace ModelContextProtocol.Protocol.Messages;
/// <summary>
/// Provides names for request methods used in the Model Context Protocol (MCP).
/// Provides constants with the names of common request methods used in the MCP protocol.
/// </summary>
public static class RequestMethods
{
/// <summary>
/// Sent from the client to request a list of tools the server has.
/// The name of the request method sent from the client to request a list of the server's tools.
/// </summary>
public const string ToolsList = "tools/list";
/// <summary>
/// Used by the client to invoke a tool provided by the server.
/// The name of the request method sent from the client to request that the server invoke a specific tool.
/// </summary>
public const string ToolsCall = "tools/call";
/// <summary>
/// Sent from the client to request a list of prompts and prompt templates the server has.
/// The name of the request method sent from the client to request a list of the server's prompts.
/// </summary>
public const string PromptsList = "prompts/list";
/// <summary>
/// Used by the client to get a prompt provided by the server.
/// The name of the request method sent by the client to get a prompt provided by the server.
/// </summary>
public const string PromptsGet = "prompts/get";
/// <summary>
/// Sent from the client to request a list of resources the server has.
/// The name of the request method sent from the client to request a list of the server's resources.
/// </summary>
public const string ResourcesList = "resources/list";
/// <summary>
/// Sent from the client to the server, to read a specific resource URI.
/// The name of the request method sent from the client to read a specific server resource.
/// </summary>
public const string ResourcesRead = "resources/read";
/// <summary>
/// Sent from the client to request a list of resource templates the server has.
/// The name of the request method sent from the client to request a list of the server's resource templates.
/// </summary>
public const string ResourcesTemplatesList = "resources/templates/list";
/// <summary>
/// Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.
/// The name of the request method sent from the client to request <see cref="NotificationMethods.ResourceUpdatedNotification"/>
/// notifications from the server whenever a particular resource changes.
/// </summary>
public const string ResourcesSubscribe = "resources/subscribe";
/// <summary>
/// Sent from the client to request cancellation of resources/updated notifications from the server.
/// The name of the request method sent from the client to request unsubscribing from <see cref="NotificationMethods.ResourceUpdatedNotification"/>
/// notifications from the server.
/// </summary>
public const string ResourcesUnsubscribe = "resources/unsubscribe";
/// <summary>
/// Sent from the server to request a list of root URIs from the client.
/// The name of the request method sent from the server to request a list of the client's roots.
/// </summary>
public const string RootsList = "roots/list";
/// <summary>
/// A ping, issued by either the server or the client, to check that the other party is still alive.
/// The name of the request method sent by either endpoint to check that the connected endpoint is still alive.
/// </summary>
public const string Ping = "ping";
/// <summary>
/// A request from the client to the server, to enable or adjust logging.
/// The name of the request method sent from the client to the server to adjust the logging level.
/// </summary>
/// <remarks>
/// This request allows clients to control which log messages they receive from the server
/// by setting a minimum severity threshold. After processing this request, the server will
/// send log messages with severity at or above the specified level to the client as
/// <see cref="NotificationMethods.LoggingMessageNotification"/> notifications.
/// </remarks>
public const string LoggingSetLevel = "logging/setLevel";
/// <summary>
/// A request from the client to the server, to ask for completion options.
/// The name of the request method sent from the client to the server to ask for completion suggestions.
/// </summary>
/// <remarks>
/// This is used to provide autocompletion-like functionality for arguments in a resource reference or a prompt template.
/// The client provides a reference (resource or prompt), argument name, and partial value, and the server
/// responds with matching completion options.
/// </remarks>
public const string CompletionComplete = "completion/complete";
/// <summary>
/// A request from the server to sample an LLM via the client.
/// The name of the request method sent from the server to sample an large language model (LLM) via the client.
/// </summary>
/// <remarks>
/// This request allows servers to utilize an LLM available on the client side to generate text or image responses
/// based on provided messages. It is part of the sampling capability in the Model Context Protocol and enables servers to access
/// client-side AI models without needing direct API access to those models.
/// </remarks>
public const string SamplingCreateMessage = "sampling/createMessage";
/// <summary>
/// This request is sent from the client to the server when it first connects, asking it to begin initialization.
/// The name of the request method sent from the client to the server when it first connects, asking it initialize.
/// </summary>
/// <remarks>
/// The initialize request is the first request sent by the client to the server. It provides client information
/// and capabilities to the server during connection establishment. The server responds with its own capabilities
/// and information, establishing the protocol version and available features for the session.
/// </remarks>
public const string Initialize = "initialize";
}