Uh oh!
There was an error while loading. Please reload this page.
feat: add SEP-2575 meta helpers - #942
Conversation
DaleSeo
left a comment
There was a problem hiding this comment.
Thanks for adding this, @howardjohn! I have a few comments.
| /// `_meta` key carrying the MCP protocol version for this request. | ||
| pub const META_KEY_PROTOCOL_VERSION: &str = "io.modelcontextprotocol/protocolVersion"; | ||
| /// `_meta` key carrying the client implementation identity for this request. | ||
| pub const META_KEY_CLIENT_INFO: &str = "io.modelcontextprotocol/clientInfo"; | ||
| /// `_meta` key carrying the client capabilities for this request. | ||
| pub const META_KEY_CLIENT_CAPABILITIES: &str = "io.modelcontextprotocol/clientCapabilities"; | ||
| /// `_meta` key carrying the requested per-request log level. | ||
| pub const META_KEY_LOG_LEVEL: &str = "io.modelcontextprotocol/logLevel"; |
There was a problem hiding this comment.
Do these constants need to be part of the public API? It seems like the getters and setters below should be sufficient for consumers. How about we keep them internal until there's a clear need for them downstream?
There was a problem hiding this comment.
I would also consider making these private associated constants on Meta instead of module-level constants. The raw keys are only used by the Meta helpers, so keeping them under impl Meta makes the ownership clearer.
| { | ||
| self.0 | ||
| .get(key) | ||
| .and_then(|value| serde_json::from_value(value.clone()).ok()) |
There was a problem hiding this comment.
Serde can deserialize directly from &Value instead of cloning Value every time.
| .and_then(|value| serde_json::from_value(value.clone()).ok()) | |
| .and_then(|value| T::deserialize(value).ok()) |
DaleSeo
commented
Jun 30, 2026
Expose typed accessors for the per-request protocol version, client info, client capabilities, and log level entries carried in _meta without making those fields required for older peers. Fixesmodelcontextprotocol#869
b335bf5 to
9e05c5fCompareUh oh!
There was an error while loading. Please reload this page.

Motivation and Context
Expose typed accessors for the per-request protocol version, client info, client capabilities, and log level entries carried in _meta without making those fields required for older peers.
This is needed for part of SEP-2575 which requires reading/writing these fields. Obviously its possible to set these manually today but given these are first class fields it seems nice to have typed APIs for them.
For #869
How Has This Been Tested?
Testing in Agentgateway (unmerged)
Breaking Changes
No
Types of changes
Checklist
Additional context