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 from 0eff32a to aa4fef7 Compare August 19, 2025 13:42
@aharvard aharvard force-pushed the feat/resource-link branch 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
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 support for the MCP ResourceLink content block to align with the MCP schema specification dated 2025-06-18. The ResourceLink allows tools and prompts to reference server resources without embedding their full payloads, enabling on-demand fetching.

Key changes include:

  • Addition of RawContent::ResourceLink and PromptMessageContent::ResourceLink variants with serde tag "resource_link"
  • Helper constructors for creating resource link content blocks
  • JSON schema updates reflecting the new content type structure
  • Updated embedded text to use "text/plain" MIME type for compliance

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 constructor methods
crates/rmcp/src/model/prompt.rs Adds ResourceLink variant to PromptMessageContent enum and constructor
crates/rmcp/tests/test_message_schema/*.json Updates JSON schemas to include new ResourceLink definitions and structure
Comments suppressed due to low confidence (1)

crates/rmcp/src/model/content.rs:1

  • This test function is placed outside the mod tests block. It should be moved inside the existing test module to maintain consistent test organization.
//! Content sent around agents, extensions, and LLMs

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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