McpRequestMeta class
Reverse-DNS _meta keys and typed read/write helpers for the 2026-07-28
stateless core (SEP-2577).
On the stateless path there is no initialize handshake, so a client
attaches its identity and per-request capabilities to the _meta object
of EVERY request under the reserved io.modelcontextprotocol/* prefix
(the second label modelcontextprotocol is reserved for MCP use). The
server reads them per request and MUST NOT infer capabilities from any
prior request.
These are additive helpers layered on top of the existing _meta
passthrough — they neither consume nor rewrite unknown _meta keys, so a
legacy (handshake) request that never sets them is unaffected.
Draft schema (schema/draft/schema.ts, RequestMetaObject /
ResultMetaObject) is the source of truth for the key names and value
shapes; see docs/STATELESS-COEXISTENCE-DESIGN.md §3.2.
- Annotations
-
- @immutable
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
-
build(
{required String protocolVersion, required Map< String, dynamic> clientCapabilities, Map<String, dynamic> ? clientInfo, String? logLevel, Map<String, dynamic> ? extra}) → Map<String, dynamic> -
Build a request
_metaobject carrying the reverse-DNS stateless keys. -
buildResult(
{required Map< String, dynamic> serverInfo, Map<String, dynamic> ? extra}) → Map<String, dynamic> -
Build a result
_metaobject carryingserverInfo, mergingextrafirst so the reserved key wins. Returns a fresh map. -
readClientCapabilities(
Object? meta) → Map< String, dynamic> ? -
Read
io.modelcontextprotocol/clientCapabilitiesfrom a request_meta. Returnsnullwhen absent (distinct from an empty object, which means "declared, no optional capabilities"). -
readClientInfo(
Object? meta) → Map< String, dynamic> ? -
Read
io.modelcontextprotocol/clientInfofrom a request_meta. -
readLogLevel(
Object? meta) → String? -
Read
io.modelcontextprotocol/logLevelfrom a request_meta. -
readProtocolVersion(
Object? meta) → String? -
Read
io.modelcontextprotocol/protocolVersionfrom a request_meta. -
readServerInfo(
Object? meta) → Map< String, dynamic> ? -
Read
io.modelcontextprotocol/serverInfofrom a result_meta. -
readSubscriptionId(
Object? meta) → Object? -
Read
io.modelcontextprotocol/subscriptionIdfrom a notification_meta. -
withSubscriptionId(
Map< String, dynamic> ? params, Object subscriptionId) → Map<String, dynamic> -
Stamp
subscriptionIdonto a copy ofparams(a notificationparamsobject), setting_meta."io.modelcontextprotocol/subscriptionId". Never mutates the input; merges into any existing_meta.
Constants
- keyClientCapabilities → const String
-
RequestMetaObject."io.modelcontextprotocol/clientCapabilities"— the client's capabilities FOR THIS REQUEST (REQUIRED on the stateless path). An empty object means no optional capabilities. Servers MUST NOT infer capabilities from prior requests. - keyClientInfo → const String
-
RequestMetaObject."io.modelcontextprotocol/clientInfo"— self-reported client software identity (name+version). Display/logging only; the server MUST NOT use it for behavior or security decisions. - keyLogLevel → const String
-
RequestMetaObject."io.modelcontextprotocol/logLevel"— the per-request desired log level (replaces thelogging/setLevelRPC). Optional; when absent the server emits nonotifications/messagefor this request. - keyProtocolVersion → const String
-
RequestMetaObject."io.modelcontextprotocol/protocolVersion"— the MCP protocol version for this request (REQUIRED on the stateless path). For HTTP it MUST equal theMCP-Protocol-Versionheader. - keyServerInfo → const String
-
ResultMetaObject."io.modelcontextprotocol/serverInfo"— self-reported server software identity carried on a response_meta. - keySubscriptionId → const String
-
NotificationMetaObject."io.modelcontextprotocol/subscriptionId"— the JSON-RPC id of thesubscriptions/listenrequest that opened the stream a notification was delivered on. The server MUST stamp this on every notification sent via a subscription stream (also carried onSubscriptionsListenResult._meta). Absent on non-subscription notifications (e.g. in-flight progress).