McpProtocol class
MCP Protocol Version constants and definitions
- Annotations
-
- @immutable
Constructors
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
-
defaultsJsonSchemaDialect(
String version) → bool -
Whether tool schemas emitted to the negotiated
versionshould carry an explicit$schema: <2020-12>default annotation (SEP-1613). Applied for 2025-11-25 and later peers; older peers keep prior output. -
isStateless(
String version) → bool -
Whether the
versionuses the stateless core (no handshake/session): client info/caps in_metaper request,server/discoverfor caps,MCP-Protocol-Versionthe sole version signal. Introduced 2026-07-28. -
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
versionunderstands theMCP-Protocol-VersionHTTP header (mandatory after negotiation from 2025-06-18 onwards). -
supportsBatching(
String version) → bool -
Whether the negotiated
versionsupports JSON-RPC batching. A bounded legacy set — batching was removed in 2025-06-18 (PR #416), so this is intentionally not an "at least" gate. -
supportsElicitation(
String version) → bool -
Whether the negotiated
versionknows theelicitation/createserver → client request (introduced in 2025-06-18, carried forward). -
supportsIconsAndSamplingTools(
String version) → bool -
Whether the negotiated
versionunderstandsTool.icons, samplingtools/toolChoice, and URL-mode elicitation (introduced in 2025-11-25, carried forward). -
supportsStructuredToolOutput(
String version) → bool -
Whether the negotiated
versionunderstandsTool.outputSchema,CallToolResult.structuredContent, andresource_linkcontent (introduced in 2025-06-18, carried forward). -
toolErrorsAsResult(
String version) → bool -
Whether tool execution errors are returned as an
isErrorCallToolResult (so the model can self-correct) rather than a JSON-RPC protocol error. Clarified in 2025-11-25 (SEP-1303) and carried forward. Older negotiated versions keep the prior protocol-error behavior. -
withDefaultSchemaDialect(
Map< String, dynamic> schema) → Map<String, dynamic> -
Returns a copy of
schemaannotated with the default JSON Schema 2020-12 dialect ($schema) when it is an object-type schema that does not already declare a$schema. Free-form schemas that already carry a$schema, or non-object schema fragments, are returned unchanged.
Constants
- errorMethodNotFound → const int
- jsonRpcVersion → const String
- jsonSchemaDialect2020_12 → const String
-
Canonical URI of the JSON Schema 2020-12 dialect — the default dialect
for tool
inputSchema/outputSchemaas of 2025-11-25 (SEP-1613). - 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
- v2026_07_28 → const String
-
Protocol version 2026-07-28 — BREAKING: stateless core (removes the
initialize/initializedhandshake andMcp-Session-Id; client info/caps ride_metaon every request;server/discoverfetches caps on demand), Extensions framework, Tasks extension, auth hardening, deprecations. Adopted as an additive, version-gated parallel path — the handshake path stays for ≤2025-11-25 peers. Deliberately NOT in supportedVersions until the stateless request path lands, so handshake negotiation does not advertise it yet. Seedocs/STATELESS-COEXISTENCE-DESIGN.md.