feat: add resource_link support to tools and prompts#381
feat: add resource_link support to tools and prompts#3814t145 merged 3 commits intomodelcontextprotocol:mainfrom
Conversation
28057c6 to
c9fde77
Compare
c34d426 to
c4acd32
Compare
aa4fef7 to
5812189
Compare
0a53835 to
305b58e
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR adds MCP ResourceLink content block support to align rmcp with the MCP 2025-06-18 specification, enabling references to server resources without embedding their payloads.
- Adds ResourceLink content type with URI-based resource referencing
- Updates embedded text MIME type to use proper "text/plain" instead of generic "text"
- Includes comprehensive test coverage for new functionality
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/rmcp/src/model/content.rs | Adds ResourceLink variant to RawContent enum and constructors for resource linking |
| crates/rmcp/src/model/prompt.rs | Adds ResourceLink support to PromptMessageContent for prompts/get |
| crates/rmcp/tests/test_message_schema/*.json | Updates JSON schema files to reflect new ResourceLink type definitions |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
a54f798 to
3dcfba3
Compare
|
@4t145, I am converting this PR back to a draft state. Something happened when I rebased and force-pushed. I've been working thru failing merge checks with Goose and don't like the edits I'm seeing. I'll notify when ready for another review. |
364059f to
dc96c4a
Compare
d3273e0 to
3b1cd0f
Compare
3b1cd0f to
71978a9
Compare
|
Ready for re-review @4t145. Please take another look at everything I re-rolled my attempt entirely. Pinging @alexhancock as well. |
|
Will look later today @aharvard |
…tocol#381) * feat: add resource_link support to tools and prompts * chore: remove unused serde_json import from test_resource_link_integration.rs * chore: remove unused serde_json import from test_resource_link.rs


Summary
This PR adds support for the
resource_linkcontent type to the Rust SDK, as specified in the MCP specification. This allows both tools and prompts to return links to resources without embedding the full content, which is useful for large files or resources that should be fetched on-demand.Changes
Core Implementation
ResourceLinkvariant toRawContentenum incontent.rswithsnake_casediscriminantResourceLinkvariant toPromptMessageContentenum inprompt.rs#[serde(rename_all = "snake_case")]to match the MCP specHelper Methods
Content::resource_link()- Create resource link content for toolsRawContent::resource_link()- Create raw resource link contentRawContent::as_resource_link()- Access resource link from contentPromptMessageContent::resource_link()- Create resource link for promptsPromptMessage::new_resource_link()- Create resource link prompt messageTests
"type": "resource_link"Schema Updates
resource_linktypeExample Usage
Tools returning resource links:
Prompts returning resource links:
Compatibility
Testing
All tests pass including: