Skip to content

feat(vmcp): add support for ResourceLink content type#4023

Open
Sanskarzz wants to merge 4 commits intostacklok:mainfrom
Sanskarzz:suppResourceLink
Open

feat(vmcp): add support for ResourceLink content type#4023
Sanskarzz wants to merge 4 commits intostacklok:mainfrom
Sanskarzz:suppResourceLink

Conversation

@Sanskarzz
Copy link
Contributor

@Sanskarzz Sanskarzz commented Mar 5, 2026

Summary

This PR implements support for the ResourceLink content type (type discriminant "resource_link") in the vMCP bridge layer. Previously, ResourceLink content returned by backend MCP servers was unrecognized by the conversion layer, causing it to fall through to "unknown" and eventually be emitted as empty text, losing critical resource pointers and metadata.

Key Changes

  • Core Types: Extended vmcp.Content in pkg/vmcp/types.go to include Name and Description fields, allowing it to faithfully represent a ResourceLink .
  • Conversion Layer: Added contentTypeLink constant to pkg/vmcp/conversion/content.go. Updated ConvertMCPContent to detect mcp.ResourceLink via type assertion and map it to vmcp.Content. Updated ToMCPContent to reconstruct mcp.ResourceLink using mcp.NewResourceLink.
  • Tests: Added new test cases to TestConvertMCPContent and TestToMCPContent in conversion_test.go. Added TestResourceLinkRoundTrip to verify that data is preserved when converting in both directions.

Validation Results

All tests in pkg/vmcp/conversion and pkg/vmcp/server/adapter pass. go vet is clean.

Fixes #3960

Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>
@github-actions github-actions bot added the size/S Small PR: 100-299 lines changed label Mar 5, 2026
@codecov
Copy link

codecov bot commented Mar 5, 2026

Codecov Report

❌ Patch coverage is 95.83333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 68.64%. Comparing base (0791876) to head (d427091).

Files with missing lines Patch % Lines
pkg/vmcp/conversion/content.go 95.83% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4023      +/-   ##
==========================================
+ Coverage   68.62%   68.64%   +0.01%     
==========================================
  Files         445      445              
  Lines       45374    45385      +11     
==========================================
+ Hits        31140    31154      +14     
+ Misses      11827    11826       -1     
+ Partials     2407     2405       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Sanskarzz Sanskarzz marked this pull request as ready for review March 6, 2026 19:39
@jerm-dro
Copy link
Contributor

jerm-dro commented Mar 7, 2026

Hey @Sanskarzz thanks for the PR. I notice "[WIP]" in the PR description. Is this ready for review?

jerm-dro
jerm-dro previously approved these changes Mar 7, 2026
// Supported types: "text", "image", "audio", "resource", "resource_link".
type Content struct {
// Type indicates the content type: "text", "image", "audio", "resource"
// Type indicates the content type: "text", "image", "audio", "resource", "resource_link"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion, non-blocking: we could make this a type. Then, we wouldn't have to repeatedly document the supported types. For example:

type SupportedContentType string

const (
   SupportedContentTypeText SupportedContentType = "text"
   // ... and so on
)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added ContentType as a string alias and updated all affected test files (including integration tests) to ensure type safety and consistency.

@Sanskarzz
Copy link
Contributor Author

Sanskarzz commented Mar 8, 2026

Hey @Sanskarzz thanks for the PR. I notice "[WIP]" in the PR description. Is this ready for review?

Apologies, my bad. The PR is ready to review.

Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>
@github-actions github-actions bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Mar 8, 2026
@github-actions github-actions bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Mar 9, 2026
Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>
@github-actions github-actions bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Mar 9, 2026
@Sanskarzz Sanskarzz requested a review from jerm-dro March 9, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Small PR: 100-299 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ResourceLink content type support to vmcp bridge

2 participants