-
Notifications
You must be signed in to change notification settings - Fork 183
Description
Summary
The vmcp bridge layer (pkg/vmcp/conversion/content.go and pkg/vmcp/server/adapter/handler_factory.go) handles bidirectional conversion between MCP SDK types and the internal vmcp.Content type. It currently supports TextContent, ImageContent, AudioContent, and EmbeddedResource, but does not handle ResourceLink — a distinct content type introduced in the MCP 2025-06-18 spec.
Any backend MCP server returning resource_link content in tool results will have it silently converted to empty text, losing the URI, name, description, and MIME type.
Details
ResourceLink (type discriminant: "resource_link") is a pointer/reference to a resource, as opposed to EmbeddedResource which carries the resource contents inline. It's defined in both the 2025-06-18 and 2025-11-25 MCP specs and is fully supported in mcp-go v0.44.0:
- Type:
mcp.ResourceLink(mcp/types.go:1117) - Constructor:
mcp.NewResourceLink(uri, name, description, mimeType)(mcp/utils.go:252) - Constant:
mcp.ContentTypeLink = "resource_link"(mcp/consts.go:7) - JSON unmarshal: handled in
UnmarshalContent(mcp/types.go:1567) - No
AsResourceLink()helper — requires direct type assertion:content.(mcp.ResourceLink)
ResourceLink fields (per SDK)
type ResourceLink struct {
Annotated
Type string `json:"type"` // "resource_link"
URI string `json:"uri"`
Name string `json:"name"`
Description string `json:"description"`
MIMEType string `json:"mimeType"`
}What needs to change
- Extend
vmcp.Content(pkg/vmcp/types.go) — addNameandDescriptionfields (or introduce a new type/approach) - MCP → vmcp direction (
pkg/vmcp/conversion/content.go) — add aResourceLinkbranch inConvertMCPContent - vmcp → MCP direction (
pkg/vmcp/server/adapter/handler_factory.go) — add a"resource_link"case inconvertToMCPContent - Tests for both directions
Current behavior
// content.go — ResourceLink falls through to unknown
slog.Debug("Encountered unknown MCP content type", ...)
return vmcp.Content{Type: "unknown"}
// handler_factory.go — "unknown" becomes empty text
slog.Warn("converting unknown content type to empty text - this may cause data loss", ...)
return mcp.NewTextContent("")Found during review of #3953.