Documentation
¶
Overview ¶
Package conversion provides utilities for converting between MCP SDK types and vmcp wrapper types. This package centralizes conversion logic to ensure consistency and eliminate duplication.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContentArrayToMap ¶
ContentArrayToMap converts a vmcp.Content array to a map for template variable substitution. This is used by composite tool workflows and backend result handling.
Conversion rules:
- First text content: key="text"
- Subsequent text content: key="text_1", "text_2", etc.
- Image content: key="image_0", "image_1", etc.
- Audio content: ignored (not supported for template substitution)
- Resource content: ignored (handled separately, not converted to map)
- Unknown content types: ignored (warnings logged at conversion boundaries)
This ensures consistent behavior between client response handling and workflow step output processing.
func FromMCPMeta ¶
FromMCPMeta converts MCP SDK meta to map[string]any for vmcp wrapper types. This preserves the _meta field from backend MCP server responses.
Returns nil if meta is nil or empty, following the MCP specification that _meta is optional and should be omitted when empty.
func ToMCPMeta ¶
ToMCPMeta converts vmcp meta map to MCP SDK meta for forwarding to clients. This reconstructs the _meta field when sending responses back through the MCP protocol.
Returns nil if meta is nil or empty, following the MCP specification that _meta is optional and should be omitted when empty.
Types ¶
This section is empty.