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>,
}http and protocol-2026-07-28 only.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 2025-11-25logging/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 2025-11-25 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
Creates a request meta 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
Clears 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
Attaches 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.
Opts 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
Adds 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 moreSource§impl Debug for RequestMetaObject
impl Debug for RequestMetaObject
Source§impl<'de> Deserialize<'de> for RequestMetaObject
impl<'de> Deserialize<'de> for RequestMetaObject
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<RequestMetaObject, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<RequestMetaObject, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for RequestMetaObject
impl Serialize for RequestMetaObject
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Auto Trait Implementations§
impl Forget for RequestMetaObject
impl Freeze for RequestMetaObject
impl Move for RequestMetaObject
impl RefUnwindSafe for RequestMetaObject
impl Send for RequestMetaObject
impl Sync for RequestMetaObject
impl Unpin for RequestMetaObject
impl UnsafeUnpin for RequestMetaObject
impl UnwindSafe for RequestMetaObject
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more