Interactions: stateless replay of an `mcp_server_tool_result` whose `structured_content` holds a `$ref` returns 400
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start by tracing how the SDK models and serializes mcp_server_tool_result steps for stateless Interactions API requests; the issue does not name specific files or tests. Compare the returned structured_content reference with the replayed function response, then add a regression test using the reproduction shape. Done means replaying the emitted steps succeeds when structured_content contains a $ref.
索引モデルが issue の本文から書いたものです。
説明
This issue was posted by Claude Code using claude-opus-5-5 on behalf of David.
Interactions API rejects its own mcp_server_tool_result step on stateless replay when structured_content contains a $ref.
With store: false, sending back the steps a previous interaction returned fails with HTTP 400 when an MCP image result came from a server that also sets structuredContent:
400 {"error":{"message":"The referenced name `structured_content.result[0]` in function_response.response does not match to a display_name in the function_response.parts.","code":"invalid_request"}}
The step is exactly what the API emitted. Image results without structured_content, and audio and embedded-resource results, replay fine (200).
Reproduce (raw HTTP, no SDK)
-
Run a public MCP server with a tool returning an
ImageContentblock and matchingstructuredContent. FastMCP does this for a tool annotated-> list[ImageContent]:from mcp.server.fastmcp import FastMCP from mcp.types import ImageContent PNG = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR4nGNg+M/A8B8ABf4C/gzLSmsAAAAASUVORK5CYII=' mcp = FastMCP('probe', stateless_http=True) @mcp.tool() def get_image() -> list[ImageContent]: return [ImageContent(type='image', data=PNG, mimeType='image/png')] mcp.run(transport='streamable-http') -
POST /v1beta/interactionswithmodel: gemini-3.8-flash,store: false,tools: [{"type": "mcp_server", "name": "probe", "url": "<server>/mcp"}], and auser_inputasking it to callget_image. The response contains:{"type": "mcp_server_tool_result", "call_id": "...", "signature": "...", "name": "probe:get_image", "server_name": "probe", "result": {"call_tool_result_json": "{\"content\":[{\"type\":\"image\",...}],\"structuredContent\":{...}}", "structured_content": {"result": [{"$ref": "structured_content.result[0]"}]}}} -
Send a second request whose
inputis the firstuser_input, every returned step unchanged, and a newuser_input. It returns the 400 above. Dropping only that tool's call and result steps returns 200.
Related: the live result shape differs from the reference and SDK types
- The API reference documents
mcp_server_tool_result.resultas(ImageContent or TextContent) array,objectorstring. Live results for text, image, audio and embedded-resource tools all arrive as an undocumented object:call_tool_result_json(the MCPCallToolResultas a JSON string), optionalstructured_content, a plain-textresult, and for blob resources a key named after the MIME type ("application/pdf": "<base64>"). MCPServerToolResultStepResultin this SDK is an empty model, so none of those fields are typed. The list branch types only text and image items; audio, video and document items parse asUnknownFunctionResultSubcontent.
Observed with google-genai 2.30.0 on the Gemini API (gemini-3.8-flash), November 2026.
- 主要言語
- Python
- スター
- 4.1k
- フォーク
- 1.1k
- 平均マージ
- 1日 21時間
- マージ済み PR(30日)
- 103
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
googleapis/python-genai のほかの issue
-
Test import module that doesn't exist対応中かも @Venkaiahbabuneelam が 24 日前に担当しました。 オープンpriority: p2 type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
googleapis/python-genai#3122 · コメント 6 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Curated history keeps half a user turn when the model turn is invalid対応中かも @Venkaiahbabuneelam が 33 日前に担当しました。 オープンpriority: p2 type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
googleapis/python-genai#3051 · コメント 3 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: Unsubscripted typing.List and typing.Dict crash convert_if_exist_pydantic_model in AFC対応中かも @Venkaiahbabuneelam が 33 日前に担当しました。 オープンpriority: p2 type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
googleapis/python-genai#3044 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
googleapis/python-genai#3314 ·
メンテナーはふだん 1 日以内に返信
-
SyntaxWarning on import in 3.0.0 (invalid escape sequence in types.py)対応中かも @VISHNU0906 が 1 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 35/100
googleapis/python-genai#3308 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
googleapis/python-genai の issue をすべて見る
似ている issue
-
integration: logger
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
home-assistant/core#191147 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
documentation p4
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
MillenniumDawn/focus-tree-creation-tool#417 ·
メンテナーはふだん 3 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
CharlesP44/Beem_Energy#96 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
rheeloaded/paperpull#153 ·
メンテナーはふだん 1 日以内に返信