Problem
The call_tool meta-tool envelope and the agent client's unwrapping lose several parts of a downstream tool result. PR #972 fixed structuredContent; the remaining gaps:
- Image / audio payloads are discarded.
SerializeContent serializes them as {type, mimeType, dataSize} only, dropping the base64 Data (internal/metatools/formatters.go:389-400). A downstream tool returning a screenshot or rendered graph arrives as "image, 48000 bytes" with no image.
- Result
_meta is dropped. The envelope carries only {isError, content, structuredContent} (internal/metatools/handlers.go:506-512), so downstream tracing or app-specific hints in _meta never reach the client.
EmbeddedResource / ResourceLink content items survive the envelope (unknown-type fallback marshals them as-is) but are dropped by the agent client, which only reconstructs type == "text" items (internal/agent/client.go:925-929).
- Content
Annotations (audience, priority) are stripped in both directions.
Proposal
Round-trip all standard MCP content types and result _meta through the envelope and the client unwrap, as additive JSON fields (same pattern as the structuredContent fix, same three files, no change to existing envelope bytes for results that don't use these features).
Open question: the dataSize-only form for image/audio may be intentional to keep tool results small for LLM consumption. If so, keep the size-only rendering in the text representation but carry the full payload in the reconstructed content items, or gate payload passthrough behind a call_tool argument.
Problem
The
call_toolmeta-tool envelope and the agent client's unwrapping lose several parts of a downstream tool result. PR #972 fixedstructuredContent; the remaining gaps:SerializeContentserializes them as{type, mimeType, dataSize}only, dropping the base64Data(internal/metatools/formatters.go:389-400). A downstream tool returning a screenshot or rendered graph arrives as "image, 48000 bytes" with no image._metais dropped. The envelope carries only{isError, content, structuredContent}(internal/metatools/handlers.go:506-512), so downstream tracing or app-specific hints in_metanever reach the client.EmbeddedResource/ResourceLinkcontent items survive the envelope (unknown-type fallback marshals them as-is) but are dropped by the agent client, which only reconstructstype == "text"items (internal/agent/client.go:925-929).Annotations(audience, priority) are stripped in both directions.Proposal
Round-trip all standard MCP content types and result
_metathrough the envelope and the client unwrap, as additive JSON fields (same pattern as thestructuredContentfix, same three files, no change to existing envelope bytes for results that don't use these features).Open question: the
dataSize-only form for image/audio may be intentional to keep tool results small for LLM consumption. If so, keep the size-only rendering in the text representation but carry the full payload in the reconstructed content items, or gate payload passthrough behind acall_toolargument.