Whether a shared (public) or per-client (private) cache may hold a result.
Standard Streamable HTTP request headers introduced by the draft.
One unit of input the server needs from the client to continue (replacing a server-initiated sampling/createMessage, elicitation/create, or roots/list request). The kind of server->client request an MRTR InputRequest stands in for. Maps to the wire type discriminator ("sampling"/"elicitation"/"roots").
Reserved _meta keys defined by the draft (2026-07-28) revision.
Decode an Mcp-Param-* header value produced by encodeHeaderValue.
Emit the shared MRTR (SEP-2322) InputRequiredResult payload onto j: the inputRequests map plus the optional top-level requestState. This is the glue common to InputRequiredResult.toJson and CallToolResult.toJson; it deliberately does NOT write the resultType discriminator (a CallToolResult stamps that elsewhere), so callers add it themselves when required.
Encode a tool-parameter value for transmission in an Mcp-Param-* header. Plain-ASCII values pass through; anything else (non-ASCII, control chars, surrounding whitespace, or a value that looks like the sentinel) is wrapped as =?base64?<base64-of-utf8>?=.
Parse a spec InputRequests object (map keyed by id) back into the internal InputRequest list. A non-object value yields no requests.
Serialize a list of InputRequests as a spec InputRequests object: a map keyed by each request's server-assigned id, with { method, params } request objects as values (SEP-2322, draft basic/utilities/mrtr).
Serialize a list of InputResponses as a spec InputResponses object: a map whose keys are the originating InputRequest.ids and whose values are the *bare* client results (e.g. {action, content} or {role, content, model, stopReason}) — not {id, result} wrappers and not a JSON array (SEP-2322, draft basic/utilities/mrtr).
Whether a header value would corrupt the request line if written verbatim: an embedded CR or LF lets the value terminate the current header and inject further headers (or smuggle a request) into the outbound HTTP stream. The raw socket request paths call this as a last line of defence before concatenating a value onto the wire, so even a value that bypassed encodeHeaderValue cannot break framing.
Whether a JSON Schema type value is one the draft permits an x-mcp-header annotation to be applied to. Per server/tools #x-mcp-header, only the primitive types integer, string, and boolean are allowed; number is explicitly NOT permitted (its value may not round-trip through a header).
Whether a _meta key's prefix is reserved for MCP use, applying the rule for the 2025-11-25 / draft revisions: the SECOND dot-separated label of the prefix is modelcontextprotocol or mcp (e.g. io.modelcontextprotocol/, com.mcp/). com.example.mcp/ is NOT reserved. Such prefixes MUST NOT be used by non-protocol code.
Whether a _meta key's prefix is reserved for MCP use under the effective protocol version v. The two revisions differ:
Validate a user-supplied _meta key for attachment: it MUST be a well-formed key (isValidMetaKey) and MUST NOT use an MCP-reserved prefix (isReservedMetaPrefix). Returns true if the key is safe to use. Uses the 2025-11-25 / draft "second label" reserved-prefix rule; pass a ProtocolVersion to apply the rule for a specific connection.
Validate a user-supplied _meta key for attachment under the effective protocol version v: it MUST be well-formed and MUST NOT use a prefix that is MCP-reserved for that version.
A _meta key is [<prefix>]<name>. The optional <prefix> is a series of dot-separated labels followed by a /. Each label MUST start with a letter and end with a letter or digit (interior may contain hyphens). Unless empty, the <name> MUST start and end with an alphanumeric character; the interior may also contain -, _, and ..
Extract the x-mcp-header annotations from a tool inputSchema, returning a map of (top-level) parameter name -> header name (Mcp-Param-{name}).
Collect every valid x-mcp-header annotation in a tool inputSchema, recursing into nested object properties and array items schemas — the draft permits the annotation "at any nesting depth within the inputSchema, not only top-level properties". Annotations on non-primitive (number/object/array) properties, or with an invalid value, are skipped here; use validateInputSchemaHeaders to reject such schemas up front.
Parse a draft CacheableResult freshness hint from a result object. Reads ttlMs (accepting an integer or a float) and cacheScope (a string mapped to the CacheScope enum, defaulting to public). Returns null when no ttlMs field is present.
Parse the shared MRTR (SEP-2322) InputRequiredResult payload from j into requests and requestState. Inverse of emitInputRequired; shared by InputRequiredResult.fromJson and CallToolResult.fromJson. Both reads are guarded, so a j carrying neither field leaves the outputs untouched.
Read the input responses a client attached to a retried request, keyed by the originating InputRequest.id. Per SEP-2322 the wire location is the top-level params.inputResponses field (an InputResponses map, id -> bare client result) — NOT _meta.
Read the opaque SEP-2322 requestState the client echoed back on a retried request. It lives in the top-level params.requestState field. Returns an empty string when absent. The server owns this value (the client treats it as opaque), so servers MUST validate it as untrusted input.
Validate a single x-mcp-header value (the name portion of the resulting Mcp-Param-{name} header) against the draft constraints, returning a human-readable reason on violation or null when valid.
Validate every x-mcp-header annotation in a tool inputSchema against the draft constraints (server/tools #x-mcp-header): non-empty, HTTP token syntax, no CR/LF, primitive-only (number forbidden), and case-insensitive uniqueness across the whole schema. Returns a human-readable reason on the first violation, or null when every annotation is valid. Recurses to any nesting depth.
Attach the draft CacheableResult fields (ttlMs, cacheScope) to a result object from a CacheHint and return it, leaving the original untouched (matching the sibling withSubscriptionId). A freshness hint for clients/intermediaries that complements listChanged notifications.
Stamp the draft io.modelcontextprotocol/subscriptionId (MetaKey.subscriptionId) into params._meta of a JSON-RPC notification and return it, leaving the original untouched. Per draft basic/utilities/subscriptions every notification delivered on a subscriptions/listen stream MUST carry the listen request's id as subscriptionId in _meta, so clients can correlate the notification with the listen request that established the stream — this is the producer for that key. subscriptionId is the (string-rendered) JSON-RPC id of the originating subscriptions/listen request. An empty subscriptionId is a no-op (the notification is returned unchanged). Notifications carry their payload under params, so the key is nested as params._meta.<subscriptionId>.
A per-result freshness hint (draft CacheableResult): how long a result may be cached (ttl) and by whom (cacheScope). Supplied per result by the user and surfaced to client consumers. The wire field stays ttlMs (milliseconds); ttl is the typed SDK-facing value.
Result of server/discover: advertises supported versions, capabilities, and identity so a client can select a version up front (stateless lifecycle).
A result that asks the client to gather input and retry the original request with matching inputResponses.
A client's answer to one InputRequest, supplied on the retried request as a value of the top-level params.inputResponses map (SEP-2322).
A single x-mcp-header annotation discovered in a tool inputSchema, together with the path of property keys to reach the annotated value.
Per-request metadata that the draft carries in params._meta instead of a once-per-connection initialize handshake.