Skip to content

feat: add MCP resource_link (2025-06-18) #381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

aharvard
Copy link
Contributor

@aharvard aharvard commented Aug 19, 2025

Align rmcp content models with MCP 2025-06-18 by adding the ResourceLink content block.

What’s included

  • RawContent::ResourceLink (serde tag: resource_link)
  • PromptMessageContent::ResourceLink for prompts/get
  • Constructors: RawContent::resource_link and Content::resource_link
  • Embedded text uses text/plain
  • CamelCase (mimeType) compliance throughout
  • Unit tests for resource_link and embedded text

Why

  • Bring rmcp up to date with the latest MCP schema (2025-06-18) so tools and prompts can reference resources without embedding payloads.

Spec references (2025-06-18)

Notes

  • rmcp represents ResourceLink as a flattened Annotated with type="resource_link"; annotations are carried by the Annotated wrapper (matching the spec’s Resource.annotations?).
  • Title (BaseMetadata.title) is optional in the spec; rmcp currently uses name and optional annotations and does not add a separate title field.
  • This PR only covers model/serde updates and tests; UI/host rendering for resource_link is out of scope.

@github-actions github-actions bot added T-core Core library changes T-model Model/data structure changes labels Aug 19, 2025
@aharvard aharvard force-pushed the feat/resource-link branch 3 times, most recently from 28057c6 to c9fde77 Compare August 19, 2025 12:53
@aharvard aharvard changed the title feat(rmcp): add MCP resource_link content type feat(rmcp): add MCP resource_link (2025-06-18) Aug 19, 2025
@aharvard aharvard changed the title feat(rmcp): add MCP resource_link (2025-06-18) feat: add MCP resource_link (2025-06-18) Aug 19, 2025
@github-actions github-actions bot added T-test Testing related changes T-config Configuration file changes labels Aug 19, 2025
@aharvard aharvard force-pushed the feat/resource-link branch 2 times, most recently from c34d426 to c4acd32 Compare August 19, 2025 13:30
@github-actions github-actions bot added T-documentation Documentation improvements T-dependencies Dependencies related changes T-macros Macro changes labels Aug 19, 2025
@aharvard aharvard force-pushed the feat/resource-link branch 2 times, most recently from aa4fef7 to 5812189 Compare August 19, 2025 14:47
@github-actions github-actions bot removed T-documentation Documentation improvements T-dependencies Dependencies related changes T-macros Macro changes labels Aug 19, 2025
@aharvard aharvard marked this pull request as ready for review August 19, 2025 14:50
@4t145 4t145 requested a review from Copilot August 20, 2025 04:25
Copilot

This comment was marked as outdated.

@aharvard
Copy link
Contributor Author

FYI... I used the copilot commit suggestion and it introduce a failed merge check due to git message formatting

image image

- Add RawContent::ResourceLink (serde tag "resource_link")
- Add PromptMessageContent::ResourceLink for prompts
- Constructors: RawContent::resource_link, Content::resource_link
- Embedded text uses text/plain
- Keep camelCase compliance for mimeType
- Unit tests for resource_link and embedded text

Spec: ContentBlock includes ResourceLink and EmbeddedResource (DRAFT-2025-v3)
@aharvard aharvard force-pushed the feat/resource-link branch from 0a53835 to 305b58e Compare August 22, 2025 20:00
Change 'can be display' to 'can be displayed' in module documentation
@aharvard aharvard requested a review from Copilot August 22, 2025 20:18
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@@ -1,5 +1,7 @@
//! Content sent around agents, extensions, and LLMs
//! The various content types can be display to humans but also understood by models
//! NOTE: This file models MCP ContentBlock union types. Keep in sync with MCP draft schema.
Copy link
Preview

Copilot AI Aug 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment refers to 'MCP draft schema' but the PR description indicates this aligns with MCP 2025-06-18. Consider updating to specify the exact schema version for clarity.

Suggested change
//! NOTE: This file models MCP ContentBlock union types. Keep in sync with MCP draft schema.
//! NOTE: This file models MCP ContentBlock union types. Keep in sync with MCP 2025-06-18 schema.

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-config Configuration file changes T-core Core library changes T-model Model/data structure changes T-test Testing related changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant