RequestMeta
FinalYes
The per-request metadata that replaces the `initialize` handshake in the modern era (SEP-2575).
protocolVersion and clientCapabilities are structurally required; a
server cannot decide how to answer without them. clientInfo is a SHOULD,
and a request omitting it MUST NOT be refused.
Tags
Table of Contents
Constants
- CLIENT_CAPABILITIES : mixed = 'io.modelcontextprotocol/clientCapabilities'
- CLIENT_INFO : mixed = 'io.modelcontextprotocol/clientInfo'
- LOG_LEVEL : mixed = 'io.modelcontextprotocol/logLevel'
- PROTOCOL_VERSION : mixed = 'io.modelcontextprotocol/protocolVersion'
- SERVER_INFO : mixed = 'io.modelcontextprotocol/serverInfo'
- SUBSCRIPTION_ID : mixed = 'io.modelcontextprotocol/subscriptionId'
- TRACE_KEYS : mixed = ['traceparent', 'tracestate', 'baggage']
- OpenTelemetry trace context, exempt from the prefix rule by name so it matches what the wider ecosystem already puts on the wire.
Properties
- $clientCapabilities : ClientCapabilities
- $clientInfo : Implementation|null
- $logLevel : LoggingLevel|null
- $protocolVersion : string
- $traceContext : array<string|int, mixed>
Methods
- __construct() : mixed
- fromParams() : self
- parseLogLevel() : LoggingLevel|null
- An unparseable level means "none requested": failing the caller's actual work over a diagnostic preference would be worse.
- parseTraceContext() : array<string, string>
- Carried through opaquely: the values are the tracing ecosystem's to interpret, and a malformed one is not this server's to reject.
Constants
CLIENT_CAPABILITIES
public
mixed
CLIENT_CAPABILITIES
= 'io.modelcontextprotocol/clientCapabilities'
CLIENT_INFO
public
mixed
CLIENT_INFO
= 'io.modelcontextprotocol/clientInfo'
LOG_LEVEL
public
mixed
LOG_LEVEL
= 'io.modelcontextprotocol/logLevel'
PROTOCOL_VERSION
public
mixed
PROTOCOL_VERSION
= 'io.modelcontextprotocol/protocolVersion'
SERVER_INFO
public
mixed
SERVER_INFO
= 'io.modelcontextprotocol/serverInfo'
SUBSCRIPTION_ID
public
mixed
SUBSCRIPTION_ID
= 'io.modelcontextprotocol/subscriptionId'
TRACE_KEYS
OpenTelemetry trace context, exempt from the prefix rule by name so it matches what the wider ecosystem already puts on the wire.
public
mixed
TRACE_KEYS
= ['traceparent', 'tracestate', 'baggage']
Tags
Properties
$clientCapabilities read-only
public
ClientCapabilities
$clientCapabilities
$clientInfo read-only
public
Implementation|null
$clientInfo
= null
$logLevel read-only
public
LoggingLevel|null
$logLevel
= null
$protocolVersion read-only
public
string
$protocolVersion
$traceContext read-only
public
array<string|int, mixed>
$traceContext
= []
Methods
__construct()
public
__construct(string $protocolVersion, ClientCapabilities $clientCapabilities[, Implementation|null $clientInfo = null ][, LoggingLevel|null $logLevel = null ][, array<string, string> $traceContext = [] ]) : mixed
Parameters
- $protocolVersion : string
- $clientCapabilities : ClientCapabilities
- $clientInfo : Implementation|null = null
- $logLevel : LoggingLevel|null = null
- $traceContext : array<string, string> = []
-
W3C trace context carried through from the request
fromParams()
public
static fromParams(array<string, mixed>|null $params) : self
Parameters
- $params : array<string, mixed>|null
-
the request's
paramsmember, if any
Tags
Return values
selfparseLogLevel()
An unparseable level means "none requested": failing the caller's actual work over a diagnostic preference would be worse.
private
static parseLogLevel(mixed $level) : LoggingLevel|null
Parameters
- $level : mixed
Return values
LoggingLevel|nullparseTraceContext()
Carried through opaquely: the values are the tracing ecosystem's to interpret, and a malformed one is not this server's to reject.
private
static parseTraceContext(array<string, mixed> $meta) : array<string, string>
Parameters
- $meta : array<string, mixed>