Context
Discovered while sizing the response budget for #74. When a tool returns typed structured output, the MCP SDK emits the result twice — once as structuredContent and once as a back-compat TextContent block (the spec's backward-compatibility suggestion for clients that don't read structuredContent).
Problem
Every tool response crosses the wire at roughly twice its necessary size. For a client that reads structuredContent (which the current consumers do), the TextContent copy is pure overhead: it inflates token cost on every call and doubles the pressure against the tool-result token cap that #74's size bound exists to respect — so the bound has to budget for the doubling and trims earlier than it otherwise would.
Evidence
The SDK sets StructuredContent and, when the handler returns no explicit Content, also copies the same JSON into a TextContent block (go-sdk v1.6.1, mcp/server.go). #74's size-bound default is set conservatively specifically to account for this ~2× wire payload.
Suggested approaches (options)
Suppressing the redundant copy (e.g. returning a non-nil Content so the SDK omits the back-compat block) roughly halves every response — but it should be decided on generic-user grounds, not the current sole-consumer set (per this project's design-fork-adjudication lens):
- Verify what target clients actually consume — does the client read
structuredContent or the text block, and does the token cap count one copy or both? Suppression breaks any client that reads only the text block.
- Survey whether MCP clients broadly support
structuredContent (the 2025-06-18 spec direction); if so, the back-compat copy is vestigial for all users and suppression is safe generically.
Context
Discovered while sizing the response budget for #74. When a tool returns typed structured output, the MCP SDK emits the result twice — once as
structuredContentand once as a back-compatTextContentblock (the spec's backward-compatibility suggestion for clients that don't readstructuredContent).Problem
Every tool response crosses the wire at roughly twice its necessary size. For a client that reads
structuredContent(which the current consumers do), theTextContentcopy is pure overhead: it inflates token cost on every call and doubles the pressure against the tool-result token cap that #74's size bound exists to respect — so the bound has to budget for the doubling and trims earlier than it otherwise would.Evidence
The SDK sets
StructuredContentand, when the handler returns no explicitContent, also copies the same JSON into aTextContentblock (go-sdk v1.6.1,mcp/server.go). #74's size-bound default is set conservatively specifically to account for this ~2× wire payload.Suggested approaches (options)
Suppressing the redundant copy (e.g. returning a non-nil
Contentso the SDK omits the back-compat block) roughly halves every response — but it should be decided on generic-user grounds, not the current sole-consumer set (per this project's design-fork-adjudication lens):structuredContentor the text block, and does the token cap count one copy or both? Suppression breaks any client that reads only the text block.structuredContent(the 2025-06-18 spec direction); if so, the back-compat copy is vestigial for all users and suppression is safe generically.