Spec conformance: meta support and spec updates#415
Conversation
b52133d to
e6902c6
Compare
e6902c6 to
3180808
Compare
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| pub timestamp: Option<DateTime<Utc>>, | ||
| #[serde(skip_serializing_if = "Option::is_none", rename = "lastModified")] | ||
| pub last_modified: Option<DateTime<Utc>>, |
There was a problem hiding this comment.
I was curious about this, I asked Goose, why did we change the timestamp to last_modified?
Short answer: to match the spec and be precise.
Details:
Spec alignment: The current MCP spec uses lastModified (camelCase on the wire) to mean “when this content/resource was last updated.” Our previous timestamp field was an SDK-ism and didn’t match the spec name.
Clearer semantics: timestamp was ambiguous (creation time? event time?); lastModified explicitly conveys modification time, which also aligns with common HTTP/metadata semantics.
Cross‑SDK consistency: Other SDKs and examples use lastModified, so this keeps the Rust SDK consistent.
Rust naming: In Rust we expose last_modified and serialize as lastModified to conform to the JSON field name.
|
@alexhancock, this PR addresses your comment #386 (review) |
crates/rmcp/src/model/prompt.rs
Outdated
| } | ||
|
|
||
| /// Create a new text message with meta | ||
| pub fn new_text_with_meta<S: Into<String>>( |
There was a problem hiding this comment.
Seems like we should have ways to create each kind of prompt message with meta optionally supplied vs just this one type that has new_text and new_text_with_meta
There was a problem hiding this comment.
ok, I think I've addressed this. LMK if me and Goose got it wrong, thanks!
…-06-18 compliance
- Keep text helper; meta is currently ignored for text until schema supports it.
…uplicate non-meta variants
4f95e7f to
c8ff500
Compare
crates/rmcp/src/model/prompt.rs
Outdated
| mime_type: String, | ||
| mime_type: Option<String>, | ||
| text: Option<String>, | ||
| top_meta: Option<crate::model::Meta>, |
There was a problem hiding this comment.
resource_meta and resource_content_meta perhaps better naming here
There was a problem hiding this comment.
@alexhancock, can you check if I executed as you expected? thanks!
…#415) * feat: add _meta to content blocks and embedded resources; update schemas * feat: set default protocol version; add _meta to content blocks/resources; update schemas * chore: format content.rs via rustfmt * chore(protocol): keep LATEST at 2025-03-26 per review until full 2025-06-18 compliance * feat(prompt): add constructors with optional meta for image and resource - Keep text helper; meta is currently ignored for text until schema supports it. * refactor(prompt): simplify constructors so meta is optional; remove duplicate non-meta variants * fix: modify code comment about version * refactor(prompt): rename meta parameters in new_resource function for clarity
This PR updates the Rust SDK to align more closely with the 2025-06-18 Model Context Protocol specification and adds first-class support for meta.
Summary
timestamp->last_modified(schemalastModified)Key changes
timestamptolast_modifiedand update accessorsNotes
Follow-ups (open to maintainer guidance)
params._metaon requests (if desired)Thanks!