namespace ModelContextProtocol.Protocol; /// /// Provides constants with the names of common request methods used in the MCP protocol. /// public static class RequestMethods { /// /// The name of the request method sent from the client to request a list of the server's tools. /// public const string ToolsList = "tools/list"; /// /// The name of the request method sent from the client to request that the server invoke a specific tool. /// public const string ToolsCall = "tools/call"; /// /// The name of the request method sent from the client to request a list of the server's prompts. /// public const string PromptsList = "prompts/list"; /// /// The name of the request method sent by the client to get a prompt provided by the server. /// public const string PromptsGet = "prompts/get"; /// /// The name of the request method sent from the client to request a list of the server's resources. /// public const string ResourcesList = "resources/list"; /// /// The name of the request method sent from the client to read a specific server resource. /// public const string ResourcesRead = "resources/read"; /// /// The name of the request method sent from the client to request a list of the server's resource templates. /// public const string ResourcesTemplatesList = "resources/templates/list"; /// /// The name of the request method sent from the client to request /// notifications from the server whenever a particular resource changes. /// public const string ResourcesSubscribe = "resources/subscribe"; /// /// The name of the request method sent from the client to request unsubscribing from /// notifications from the server. /// public const string ResourcesUnsubscribe = "resources/unsubscribe"; /// /// The name of the request method sent from the server to request a list of the client's roots. /// [Obsolete(Obsoletions.DeprecatedRoots_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)] public const string RootsList = "roots/list"; /// /// The name of the request method sent by either endpoint to check that the connected endpoint is still alive. /// public const string Ping = "ping"; /// /// The name of the request method sent from the client to the server to adjust the logging level. /// /// /// 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 /// notifications. /// [Obsolete(Obsoletions.DeprecatedLogging_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)] public const string LoggingSetLevel = "logging/setLevel"; /// /// The name of the request method sent from the client to the server to ask for completion suggestions. /// /// /// 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. /// public const string CompletionComplete = "completion/complete"; /// /// The name of the request method sent from the server to sample a large language model (LLM) via the client. /// /// /// 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. /// [Obsolete(Obsoletions.DeprecatedSampling_Message, DiagnosticId = Obsoletions.Deprecated_DiagnosticId, UrlFormat = Obsoletions.Deprecated_Url)] public const string SamplingCreateMessage = "sampling/createMessage"; /// /// The name of the request method sent from the server to elicit additional information from the user via the client. /// /// /// /// This request is used when the server needs more information from the client to proceed with a task or interaction. /// Servers can request structured data from users, with optional JSON schemas to validate responses (form mode), /// or request URL mode (out-of-band) user interaction via navigation for sensitive operations. /// /// /// Two modes are supported: /// /// form: In-band elicitation where structured data is collected and returned to the server /// url: URL mode (out-of-band) elicitation for sensitive operations like OAuth or payments /// /// /// public const string ElicitationCreate = "elicitation/create"; /// /// The name of the request method sent from the client to the server when it first connects, asking it to initialize. /// /// /// 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. /// public const string Initialize = "initialize"; /// /// The name of the request method sent from the client to poll for task completion. /// /// /// Part of the io.modelcontextprotocol/tasks extension. /// Clients poll for task status by sending this request with the task ID. /// public const string TasksGet = "tasks/get"; /// /// The name of the request method sent from the client to provide input responses to a task. /// /// /// Part of the io.modelcontextprotocol/tasks extension. /// Used when a task has input_required status and the client needs to fulfill outstanding requests. /// public const string TasksUpdate = "tasks/update"; /// /// The name of the request method sent from the client to signal intent to cancel a task. /// /// /// Part of the io.modelcontextprotocol/tasks extension. /// Cancellation is cooperative — the server decides whether and when to honor it. /// public const string TasksCancel = "tasks/cancel"; /// /// The name of the request method sent from the client to discover the server's protocol versions, /// capabilities, and metadata. /// /// /// /// This RPC is introduced in the 2026-07-28 protocol revision (SEP-2575) as the canonical way for a client /// to learn what a server supports without performing the legacy initialize handshake. /// /// /// The server's response includes its supported protocol versions, capabilities, implementation /// information, and optional usage instructions. /// /// /// Servers SHOULD implement this method. Legacy clients MAY ignore it. Clients on the 2026-07-28 revision /// typically call this once during connection establishment. /// /// public const string ServerDiscover = "server/discover"; /// /// The name of the request method sent from the client to open a long-lived subscription for /// receiving server-to-client notifications outside of a specific request's response stream. /// /// /// /// This RPC is introduced in the 2026-07-28 protocol revision (SEP-2575) and replaces the unsolicited /// HTTP GET endpoint and the legacy / /// request methods. /// /// /// The request opens a response stream on which the server first sends a /// describing the granted /// notifications, and then streams matching notifications until the subscription is cancelled. /// /// public const string SubscriptionsListen = "subscriptions/listen"; }