Project these capabilities to the wire shape for protocol version v, stripping any field newer than v and migrating tasks to the draft extensions map. roots/rootsListChanged, a bare sampling, and experimental exist in every supported version and pass through unchanged. elicitation applies from 2025-06-18, so it is gated to >= 2025-06-18 (a client that set only an elicitation submode still projects a bare elicitation there). The sampling/elicitation sub-objects (sampling.tools/sampling.context, elicitation.form/elicitation.url) apply from 2025-11-25 and are stripped below that. tasks is a first-class client capability in the stable 2025-11-25 era (and any future stable revision >= 2025-11-25); the draft schema has no top-level client tasks, so for draft it is folded into extensions[tasksExtensionKey]. The extensions negotiation map itself is draft-only.
Compute the capabilities this object requires that are NOT present in declared. Used by a server to build the data.requiredCapabilities payload of a -32003 MissingRequiredClientCapabilityError: this is the set a request needs, declared is what the client actually advertised, and the result is a ClientCapabilities containing exactly the missing ones. A capability is satisfied when the client declared at least the same presence flag (sub-capability flags imply their parent presence here, in line with toJson). The result is null iff every requirement is met; a non-null value carries exactly the unmet ones. The experimental and extensions Json maps are compared by required-key presence: any required key absent from declared is reported.
Whether cap is advertised. The single lookup that owns the capability->field mapping; transports gate sample/elicit/listRoots through here rather than re-deriving it.
presence (>= 2025-06-18); empty object => form mode only
elicitation.form submode (2025-11-25): declares support for schema-driven form elicitation. Implies elicitation. An empty elicitation object is equivalent to declaring form mode only, so this is treated as set when a peer advertises a bare {}.
elicitation.url submode (2025-11-25): declares support for URL-mode elicitation (elicitUrl). Implies elicitation. Servers MUST NOT send URL-mode elicitation requests unless this is advertised.
draft Extension Negotiation: map of extension identifiers (e.g. "io.modelcontextprotocol/ui") to per-extension settings objects. Distinct from experimental.
presence (with optional listChanged below)
presence (with optional tools/context sub-caps below)
sampling.context sub-capability (soft-deprecated): gates the includeContext values thisServer/allServers. Implies sampling.
sampling.tools sub-capability (>= 2025-11-25): declares support for tool use in sampling requests. Servers MUST NOT send tool-enabled sampling requests unless this is advertised. Implies sampling.
task-augmented requests (>= 2025-11-25); client form carries only the requests map (its list/cancel fields are server-only).
Capabilities a client advertises during initialization.