feat(vmcp): add support for ResourceLink content type#4023
feat(vmcp): add support for ResourceLink content type#4023Sanskarzz wants to merge 4 commits intostacklok:mainfrom
Conversation
Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
|
Hey @Sanskarzz thanks for the PR. I notice "[WIP]" in the PR description. Is this ready for review? |
pkg/vmcp/types.go
Outdated
| // 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" |
There was a problem hiding this comment.
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
)There was a problem hiding this comment.
I've added ContentType as a string alias and updated all affected test files (including integration tests) to ensure type safety and consistency.
Apologies, my bad. The PR is ready to review. |
Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>
Summary
This PR implements support for the
ResourceLinkcontent type (type discriminant "resource_link") in the vMCP bridge layer. Previously,ResourceLinkcontent 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
pkg/vmcp/types.goto include Name and Description fields, allowing it to faithfully represent a ResourceLink .contentTypeLinkconstant to pkg/vmcp/conversion/content.go. UpdatedConvertMCPContentto detectmcp.ResourceLinkvia type assertion and map it tovmcp.Content. UpdatedToMCPContentto reconstructmcp.ResourceLinkusingmcp.NewResourceLink.TestConvertMCPContentandTestToMCPContentinconversion_test.go. AddedTestResourceLinkRoundTripto 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