Skip to content

Add ResourceLink content type support to vmcp bridge #3960

@jhrozek

Description

@jhrozek

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

  1. Extend vmcp.Content (pkg/vmcp/types.go) — add Name and Description fields (or introduce a new type/approach)
  2. MCP → vmcp direction (pkg/vmcp/conversion/content.go) — add a ResourceLink branch in ConvertMCPContent
  3. vmcp → MCP direction (pkg/vmcp/server/adapter/handler_factory.go) — add a "resource_link" case in convertToMCPContent
  4. 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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestgoPull requests that update go codevmcpVirtual MCP Server related issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions