McpTool drops structuredContent and non-text content from CallToolResult
@hemasekhar-p ci sta già lavorando.
Dal 21/8/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
🔴 Required Information
Describe the Bug:
AbstractMcpTool.wrapCallResult(...) silently discards parts of a successful MCP CallToolResult.
When the result contains at least one TextContent, native McpTool.runAsync(...) returns only the legacy text_output map. It does not expose:
CallToolResult.isErroron successful resultsCallToolResult.structuredContent- non-text
contententries such as images or embedded resources - the original ordered content list
This loss is irreversible for callers. An outer BaseTool decorator sees only the already-reduced map and cannot recover the discarded fields without bypassing native McpTool and invoking McpSyncClient itself.
Steps to Reproduce:
- Use
com.google.adk:google-adk:1.7.1. - Construct a native
McpToolsetover a streamable-HTTP MCP server. - Have the server advertise a zero-argument tool.
- Return this successful
tools/callresult:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"content": [
{"type": "text", "text": "first"},
{"type": "text", "text": "second"},
{
"type": "image",
"data": "aW1hZ2U=",
"mimeType": "image/png"
}
],
"structuredContent": {"count": 2},
"isError": false
}
}
- Call the discovered native tool through
BaseTool.runAsync(...).
Expected Behavior:
Native MCP tools should preserve the complete semantic CallToolResult, including structured content and non-text content, without breaking callers that consume the existing text_output field.
A compatible resolution could be either:
- An additive envelope that retains
text_outputunchanged while also exposingcontent,structuredContent,isError, and metadata. - A supported result-mapper/adapter hook on
McpToolsetorMcpToolthat receives the rawCallToolResultbefore reduction.
Observed Behavior:
The returned map contains only:
{text_output=[{text=first}, {text=second}]}
structuredContent, image data and MIME type, the original content parts, and explicit non-error state are absent.
The loss is silent. No exception or warning indicates that valid MCP response data was discarded.
Environment Details:
- ADK Library Version (see maven dependency):
1.7.1 - MCP Java SDK resolved by ADK:
1.1.2 - MCP transport: streamable HTTP
- Java: 21
🟡 Optional Information
Regression:
No
Additional Context:
PR #1078 changed wrapCallResult to serialize the complete CallToolResult, but PR #1090 reverted that change to preserve backward compatibility with text_output.
The requested fix is therefore not to remove text_output. It is to preserve compatibility without silently losing the remaining MCP result fields.
This blocks replacing a custom MCP bridge with native McpToolset: the custom implementation currently preserves text, structuredContent, non-text content parts, and error state, while native McpTool does not.
Minimal Reproduction Code:
N/A. The issue can be reproduced using the MCP response above and a native McpToolset over a streamable-HTTP MCP server.
How often has this issue occurred?:
- Always (100%)
- Lingua principale
- Java
- Stelle
- 1.7k
- Fork
- 421
- Merge medio
- 3g 8h
- PR unite (30g)
- 36
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di google/adk-java
-
needs review
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
needs review
-
needs review
-
needs review
-
needs review
Tutte le issue di google/adk-java
Issue simili
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
inu-appcenter/memorIN-backend#288 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
frontend maui-pilot pilot-ask question
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
executions.Query — startDate and timeRange filters are sent with inverted comparison operators Apertaarea/plugin
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
kestra-io/plugin-kestra#190 ·