1#ifndef SOURCEMETA_CORE_MCP_PROTOCOL_H_
2#define SOURCEMETA_CORE_MCP_PROTOCOL_H_
4#ifndef SOURCEMETA_CORE_MCP_EXPORT
5#include <sourcemeta/core/mcp_export.h>
8#include <sourcemeta/core/json.h>
14namespace sourcemeta::core {
72 "notifications/initialized"};
95 "subscriptions/listen"};
103 "notifications/subscriptions/acknowledged"};
148 "resources/subscribe"};
157 "resources/unsubscribe"};
167 "resources/templates/list"};
195 "completion/complete"};
213 "notifications/cancelled"};
223 "notifications/message"};
233 "notifications/progress"};
243 "notifications/prompts/list_changed"};
253 "notifications/resources/list_changed"};
263 "notifications/resources/updated"};
273 "notifications/tools/list_changed"};
302 "sampling/createMessage"};
319 "notifications/elicitation/complete"};
333 "notifications/roots/list_changed"};
341 "notifications/tasks/status"};
387[[nodiscard]]
constexpr auto
402#if !defined(__clang__)
424[[nodiscard]]
constexpr auto
426 -> std::optional<MCPProtocolVersion> {
461[[nodiscard]]
constexpr auto
465 return std::to_underlying(current) >= std::to_underlying(minimum);
483[[nodiscard]]
constexpr auto
505[[nodiscard]]
constexpr auto
527[[nodiscard]]
constexpr auto
549[[nodiscard]]
constexpr auto
571[[nodiscard]]
constexpr auto
593[[nodiscard]]
constexpr auto
616[[nodiscard]]
constexpr auto
639[[nodiscard]]
constexpr auto
662[[nodiscard]]
constexpr auto
684[[nodiscard]]
constexpr auto
707[[nodiscard]]
constexpr auto
729[[nodiscard]]
constexpr auto
752[[nodiscard]]
constexpr auto
775[[nodiscard]]
constexpr auto
844[[nodiscard]]
constexpr auto
866[[nodiscard]]
constexpr auto
912#if !defined(__clang__)
934[[nodiscard]]
constexpr auto
958#if !defined(__clang__)
981[[nodiscard]]
constexpr auto
1020#if !defined(__clang__)
1043[[nodiscard]]
constexpr auto
1058#if !defined(__clang__)
1081[[nodiscard]]
constexpr auto
1186#if !defined(__clang__)
1205[[nodiscard]]
constexpr auto
1226[[nodiscard]]
constexpr auto
1253[[nodiscard]]
constexpr auto
1259 return method ==
"notifications/cancelled" ||
1260 method ==
"notifications/initialized" ||
1261 method ==
"notifications/progress" ||
1262 method ==
"notifications/roots/list_changed";
1264 return method ==
"notifications/cancelled" ||
1265 method ==
"notifications/initialized" ||
1266 method ==
"notifications/progress" ||
1267 method ==
"notifications/tasks/status" ||
1268 method ==
"notifications/roots/list_changed";
1270 return method ==
"notifications/cancelled";
1274#if !defined(__clang__)
1297[[nodiscard]]
constexpr auto
1303 return method ==
"notifications/cancelled" ||
1304 method ==
"notifications/progress" ||
1305 method ==
"notifications/resources/list_changed" ||
1306 method ==
"notifications/resources/updated" ||
1307 method ==
"notifications/prompts/list_changed" ||
1308 method ==
"notifications/tools/list_changed" ||
1309 method ==
"notifications/message";
1311 return method ==
"notifications/cancelled" ||
1312 method ==
"notifications/progress" ||
1313 method ==
"notifications/resources/list_changed" ||
1314 method ==
"notifications/resources/updated" ||
1315 method ==
"notifications/prompts/list_changed" ||
1316 method ==
"notifications/tools/list_changed" ||
1317 method ==
"notifications/tasks/status" ||
1318 method ==
"notifications/message" ||
1319 method ==
"notifications/elicitation/complete";
1321 return method ==
"notifications/cancelled" ||
1322 method ==
"notifications/progress" ||
1323 method ==
"notifications/resources/list_changed" ||
1324 method ==
"notifications/subscriptions/acknowledged" ||
1325 method ==
"notifications/resources/updated" ||
1326 method ==
"notifications/prompts/list_changed" ||
1327 method ==
"notifications/tools/list_changed" ||
1328 method ==
"notifications/message";
1332#if !defined(__clang__)
std::basic_string_view< Char, CharTraits > StringView
The string view type used by the JSON document.
Definition json_value.h:54
constexpr JSON::StringView MCP_PROTOCOL_VERSION_2026_07_28
Definition mcp_protocol.h:55
constexpr auto mcp_requires_cacheable_metadata(const MCPProtocolVersion version) noexcept -> bool
Definition mcp_protocol.h:594
constexpr JSON::StringView MCP_PROTOCOL_VERSION_2025_06_18
Definition mcp_protocol.h:47
constexpr auto mcp_is_server_request_method(const MCPProtocolVersion version, const JSON::StringView method) noexcept -> bool
Definition mcp_protocol.h:935
constexpr auto mcp_supports_implementation_website_url(const MCPProtocolVersion version) noexcept -> bool
Definition mcp_protocol.h:822
constexpr auto mcp_is_notification_method(const MCPProtocolVersion version, const JSON::StringView method) noexcept -> bool
Definition mcp_protocol.h:982
constexpr JSON::StringView MCP_METHOD_TOOLS_LIST
Definition mcp_protocol.h:112
constexpr JSON::StringView MCP_PROTOCOL_VERSION_2025_03_26
Definition mcp_protocol.h:43
constexpr auto mcp_supports_mrtr(const MCPProtocolVersion version) noexcept -> bool
Definition mcp_protocol.h:663
MCPProtocolVersion
Definition mcp_protocol.h:30
constexpr auto mcp_supports_jsonrpc_batching(const MCPProtocolVersion version) noexcept -> bool
Definition mcp_protocol.h:845
constexpr JSON::StringView MCP_METHOD_NOTIFICATIONS_MESSAGE
Definition mcp_protocol.h:222
constexpr auto mcp_supports_server_discover(const MCPProtocolVersion version) noexcept -> bool
Definition mcp_protocol.h:617
constexpr auto mcp_supports_subscriptions_listen(const MCPProtocolVersion version) noexcept -> bool
Definition mcp_protocol.h:640
constexpr JSON::StringView MCP_METHOD_NOTIFICATIONS_SUBSCRIPTIONS_ACKNOWLEDGED
Definition mcp_protocol.h:102
constexpr auto mcp_requires_result_type(const MCPProtocolVersion version) noexcept -> bool
Definition mcp_protocol.h:572
constexpr JSON::StringView MCP_METHOD_NOTIFICATIONS_PROGRESS
Definition mcp_protocol.h:232
constexpr JSON::StringView MCP_METHOD_SUBSCRIPTIONS_LISTEN
Definition mcp_protocol.h:94
constexpr JSON::StringView MCP_METHOD_TOOLS_CALL
Definition mcp_protocol.h:121
constexpr JSON::StringView MCP_METHOD_ELICITATION_CREATE
Definition mcp_protocol.h:311
constexpr auto mcp_is_mrtr_method(const JSON::StringView method) noexcept -> bool
Definition mcp_protocol.h:1206
constexpr auto mcp_is_request_method(const MCPProtocolVersion version, const JSON::StringView method) noexcept -> bool
Definition mcp_protocol.h:867
constexpr auto mcp_is_server_notification_method(MCPProtocolVersion version, JSON::StringView method) noexcept -> bool
Definition mcp_protocol.h:1298
constexpr auto mcp_is_client_notification_method(MCPProtocolVersion version, JSON::StringView method) noexcept -> bool
Definition mcp_protocol.h:1254
constexpr JSON::StringView MCP_METHOD_NOTIFICATIONS_INITIALIZED
Definition mcp_protocol.h:71
constexpr JSON::StringView MCP_METHOD_PROMPTS_GET
Definition mcp_protocol.h:185
constexpr JSON::StringView MCP_METHOD_TASKS_LIST
Definition mcp_protocol.h:362
constexpr JSON::StringView MCP_METHOD_COMPLETION_COMPLETE
Definition mcp_protocol.h:194
constexpr JSON::StringView MCP_METHOD_NOTIFICATIONS_ROOTS_LIST_CHANGED
Definition mcp_protocol.h:332
constexpr auto mcp_supports_output_schema(const MCPProtocolVersion version) noexcept -> bool
Definition mcp_protocol.h:708
constexpr JSON::StringView MCP_METHOD_PROMPTS_LIST
Definition mcp_protocol.h:176
constexpr auto mcp_supports_structured_content(const MCPProtocolVersion version) noexcept -> bool
Definition mcp_protocol.h:730
constexpr JSON::StringView MCP_METHOD_ROOTS_LIST
Definition mcp_protocol.h:287
constexpr auto mcp_requires_request_meta(const MCPProtocolVersion version) noexcept -> bool
Definition mcp_protocol.h:550
constexpr JSON::StringView MCP_METHOD_NOTIFICATIONS_RESOURCES_LIST_CHANGED
Definition mcp_protocol.h:252
constexpr auto mcp_supports_resource_link_content(const MCPProtocolVersion version) noexcept -> bool
Definition mcp_protocol.h:753
constexpr auto mcp_resolve_protocol_version(const JSON::StringView value) noexcept -> std::optional< MCPProtocolVersion >
Definition mcp_protocol.h:425
constexpr auto mcp_is_cacheable_method(const JSON::StringView method) noexcept -> bool
Definition mcp_protocol.h:1227
constexpr JSON::StringView MCP_METHOD_LOGGING_SET_LEVEL
Definition mcp_protocol.h:203
constexpr auto mcp_protocol_version_at_least(const MCPProtocolVersion current, const MCPProtocolVersion minimum) noexcept -> bool
Definition mcp_protocol.h:462
constexpr JSON::StringView MCP_METHOD_PING
Definition mcp_protocol.h:80
constexpr JSON::StringView MCP_METHOD_NOTIFICATIONS_ELICITATION_COMPLETE
Definition mcp_protocol.h:318
constexpr auto mcp_protocol_version_is_valid(const JSON::StringView value) noexcept -> bool
Definition mcp_protocol.h:484
constexpr JSON::StringView MCP_METHOD_TASKS_CANCEL
Definition mcp_protocol.h:348
constexpr JSON::StringView MCP_METHOD_TASKS_GET
Definition mcp_protocol.h:355
constexpr JSON::StringView MCP_METHOD_SERVER_DISCOVER
Definition mcp_protocol.h:87
constexpr JSON::StringView MCP_METHOD_RESOURCES_LIST
Definition mcp_protocol.h:130
constexpr auto mcp_is_input_request_method(const MCPProtocolVersion version, const JSON::StringView method) noexcept -> bool
Definition mcp_protocol.h:1044
constexpr JSON::StringView MCP_METHOD_NOTIFICATIONS_TOOLS_LIST_CHANGED
Definition mcp_protocol.h:272
constexpr JSON::StringView MCP_METHOD_TASKS_RESULT
Definition mcp_protocol.h:369
constexpr JSON::StringView MCP_PROTOCOL_VERSION_2025_11_25
Definition mcp_protocol.h:51
constexpr JSON::StringView MCP_METHOD_NOTIFICATIONS_CANCELLED
Definition mcp_protocol.h:212
constexpr auto mcp_supports_implementation_description(const MCPProtocolVersion version) noexcept -> bool
Definition mcp_protocol.h:799
constexpr auto mcp_supports_method(const MCPProtocolVersion version, const JSON::StringView method) noexcept -> bool
Definition mcp_protocol.h:1082
constexpr auto mcp_supports_ping(const MCPProtocolVersion version) noexcept -> bool
Definition mcp_protocol.h:528
constexpr JSON::StringView MCP_METHOD_INITIALIZE
Definition mcp_protocol.h:63
constexpr auto mcp_protocol_version_string(const MCPProtocolVersion version) noexcept -> JSON::StringView
Definition mcp_protocol.h:388
constexpr JSON::StringView MCP_METHOD_RESOURCES_TEMPLATES_LIST
Definition mcp_protocol.h:166
constexpr JSON::StringView MCP_METHOD_RESOURCES_SUBSCRIBE
Definition mcp_protocol.h:147
constexpr JSON::StringView MCP_METHOD_SAMPLING_CREATE_MESSAGE
Definition mcp_protocol.h:301
constexpr JSON::StringView MCP_METHOD_NOTIFICATIONS_RESOURCES_UPDATED
Definition mcp_protocol.h:262
constexpr auto mcp_uses_initialization_handshake(const MCPProtocolVersion version) noexcept -> bool
Definition mcp_protocol.h:506
constexpr auto mcp_supports_protocol_sessions(const MCPProtocolVersion version) noexcept -> bool
Definition mcp_protocol.h:685
constexpr auto mcp_supports_implementation_title(const MCPProtocolVersion version) noexcept -> bool
Definition mcp_protocol.h:776
constexpr JSON::StringView MCP_METHOD_RESOURCES_READ
Definition mcp_protocol.h:139
constexpr JSON::StringView MCP_METHOD_NOTIFICATIONS_TASKS_STATUS
Definition mcp_protocol.h:340
constexpr JSON::StringView MCP_METHOD_NOTIFICATIONS_PROMPTS_LIST_CHANGED
Definition mcp_protocol.h:242
constexpr JSON::StringView MCP_METHOD_RESOURCES_UNSUBSCRIBE
Definition mcp_protocol.h:156
@ V_2025_03_26
Protocol revision 2025-03-26.
Definition mcp_protocol.h:32
@ V_2025_11_25
The initialization-handshake revision 2025-11-25.
Definition mcp_protocol.h:36
@ V_2026_07_28
The stateless, per-request capability negotiation revision (2026-07-28).
Definition mcp_protocol.h:38
@ V_2025_06_18
Protocol revision 2025-06-18.
Definition mcp_protocol.h:34