McpProtocol class

MCP Protocol Version constants and definitions

Annotations
  • @immutable

Constructors

McpProtocol()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

isSupported(String version) bool
Check if a version is supported
negotiate(List<String> clientVersions, List<String> serverVersions) String?
Get the highest compatible version between client and server
negotiateWithDateFallback(String? clientVersion, List<String> serverVersions) String?
Advanced version negotiation with date-based compatibility
requiresProtocolHeader(String version) bool
Whether the negotiated version understands the MCP-Protocol-Version HTTP header (mandatory after negotiation from 2025-06-18 onwards).
supportsBatching(String version) bool
Whether the negotiated version supports JSON-RPC batching. Removed in 2025-06-18 (PR #416).
supportsElicitation(String version) bool
Whether the negotiated version knows the elicitation/create server → client request (introduced in 2025-06-18).
supportsIconsAndSamplingTools(String version) bool
Whether the negotiated version understands Tool.icons, sampling tools / toolChoice, and URL-mode elicitation (introduced in 2025-11-25).
supportsStructuredToolOutput(String version) bool
Whether the negotiated version understands Tool.outputSchema, CallToolResult.structuredContent, and resource_link content (introduced in 2025-06-18).

Constants

errorMethodNotFound → const int
jsonRpcVersion → const String
latest → const String
methodCallTool → const String
methodComplete → const String
methodGetPrompt → const String
methodInitialize → const String
methodInitialized → const String
methodListPrompts → const String
methodListResources → const String
methodListTools → const String
methodReadResource → const String
supportedVersions → const List<String>
All supported versions in order of preference (newest first)
v2024_11_05 → const String
v2025_03_26 → const String
v2025_06_18 → const String
v2025_11_25 → const String