pub struct RequestMetaObject {
pub progress_token: Option<ProgressToken>,
pub protocol_version: String,
pub client_info: Option<Implementation>,
pub client_capabilities: ClientCapabilities,
pub log_level: Option<LoggingLevel>,
pub extra: HashMap<String, Value>,
}Expand description
Core MCP protocol types and error handling
Strictly-typed request _meta carrying the per-request capability
negotiation. See also MetaObject for key naming rules and reserved
prefixes, and General fields: _meta
for the full spec section.
Replaces the 2025-11-25 initialize handshake: every 2026-07-28 request’s
params._meta is REQUIRED and carries the per-request protocol version,
client info, and client capabilities. The server cannot infer these from
prior requests in the stateless model (SEP-2567, SEP-2575).
Required fields (schema: not marked ?):
io.modelcontextprotocol/protocolVersion: stringio.modelcontextprotocol/clientCapabilities: ClientCapabilities
Optional fields:
progressToken?: ProgressToken— caller opts in tonotifications/progressio.modelcontextprotocol/clientInfo?: Implementation— clients SHOULD send it unless configured otherwise. It is self-reported and unverified: servers MUST NOT key behavior on it and MUST NOT treat it as a security identity. A request that omits it is well-formed and MUST be served.io.modelcontextprotocol/logLevel?: LoggingLevel— replaces the removedlogging/setLevelRPC; client opts in to log notifications per-request
Extra keys per MetaObject rules are preserved in Self::extra.
Implementation and
ClientCapabilities are imported
from crate::initialize.
Serialize is hand-written rather than #[derive] + #[serde(flatten)]:
extra is public and caller-writable, so a caller could otherwise insert
one of the reserved typed keys (progressToken or any
io.modelcontextprotocol/* field) into it and produce the same key twice
on the wire. The typed field always wins; a colliding extra entry is
dropped rather than emitted. Mirrors the same guard on
crate::subscriptions::SubscriptionsListenResultMetaObject.
Fields§
§progress_token: Option<ProgressToken>Caller-supplied progress token. Optional.
protocol_version: StringProtocol version this request is encoded against. Required.
For HTTP transport, MUST match the MCP-Protocol-Version header.
If unsupported by the server, the server returns
McpError::UnsupportedProtocolVersion.
client_info: Option<Implementation>Identifies the client. Optional — absent is well-formed. Present but not
a valid Implementation is still a parse failure.
client_capabilities: ClientCapabilitiesClient capabilities for this specific request. Required.
Per spec: “Capabilities are declared per-request rather than once at initialization; an empty object means the client supports no optional capabilities. Servers MUST NOT infer capabilities from prior requests.”
log_level: Option<LoggingLevel>Deprecated per SEP-2577 (2026-07-28) along with the whole Logging surface. Earliest removal: first release on/after 2027-07-28.
Per-request log level opt-in. Optional.
Replaces the former logging/setLevel RPC. If absent, the server MUST
NOT send notifications/message for this request. Deprecated per
SEP-2577 along with the whole Logging surface; functional through the
migration window.
extra: HashMap<String, Value>Additional caller-supplied meta keys per the MetaObject extension rules.
Implementations§
Source§impl RequestMetaObject
impl RequestMetaObject
Sourcepub fn new(
protocol_version: impl Into<String>,
client_info: Implementation,
client_capabilities: ClientCapabilities,
) -> RequestMetaObject
pub fn new( protocol_version: impl Into<String>, client_info: Implementation, client_capabilities: ClientCapabilities, ) -> RequestMetaObject
Construct with the two required fields plus client_info, which clients
SHOULD send. Use Self::without_client_info for the configured-off
case. All other optionals start None, extra empty.
Sourcepub fn without_client_info(self) -> RequestMetaObject
pub fn without_client_info(self) -> RequestMetaObject
Drop clientInfo, modelling a client configured not to report itself.
Sourcepub fn with_progress_token(
self,
token: impl Into<ProgressToken>,
) -> RequestMetaObject
pub fn with_progress_token( self, token: impl Into<ProgressToken>, ) -> RequestMetaObject
Attach a progress token.
Sourcepub fn with_log_level(self, level: LoggingLevel) -> RequestMetaObject
👎Deprecated since 0.4.0: Deprecated per SEP-2577 (2026-07-28) along with the whole Logging surface.
pub fn with_log_level(self, level: LoggingLevel) -> RequestMetaObject
Deprecated per SEP-2577 (2026-07-28) along with the whole Logging surface.
Opt in to log notifications at this level for this request. Deprecated per SEP-2577 along with the whole Logging surface.
Sourcepub fn with_extra(
self,
key: impl Into<String>,
value: impl Into<Value>,
) -> RequestMetaObject
pub fn with_extra( self, key: impl Into<String>, value: impl Into<Value>, ) -> RequestMetaObject
Add an extra meta key. Key must follow MetaObject naming rules
(no validation performed here; keep keys spec-conformant).
Trait Implementations§
Source§impl Clone for RequestMetaObject
impl Clone for RequestMetaObject
Source§fn clone(&self) -> RequestMetaObject
fn clone(&self) -> RequestMetaObject
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more