DecodingError when handling MCP tool calls - type 'mcp_call' not recognized
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start by tracing the ResponseOutputItemDoneEvent decoder and the OutputItem schema handling mentioned in the report; reproduce with a streaming CreateModelResponseQuery using Tool.mcpTool(). The issue is resolved when an event whose item type is mcp_call decodes without a DecodingError and the stream continues.
索引モデルが issue の本文から書いたものです。
説明
Bug Description
When using MCP tools with the CreateModelResponseQuery API, the library throws a DecodingError when processing MCP tool call events.
Error Details
valueNotFound(OpenAI.Components.Schemas.OutputItem, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "item", intValue: nil)], debugDescription: "The anyOf structure did not decode into any child schema."))
Cannot initialize _TypePayload from invalid String value mcp_call
Root Cause
The server sends OutputItem with type "mcp_call" (with underscore), but the OutputItem decoder in ResponseOutputItemDoneEvent fails to decode this properly.
Steps to Reproduce
- Configure an MCP tool using
Tool.mcpTool() - Send a query using
CreateModelResponseQuerywith the MCP tool - When the model invokes the MCP tool, the stream processing fails with a DecodingError
Expected Behavior
The library should properly decode MCP tool call events without throwing errors.
Code Example
let mcpTool = Tool.mcpTool(
Components.Schemas.MCPTool(
_type: .mcp,
serverLabel: "playwright-mcp",
serverUrl: "https://example.com/mcp",
headers: Components.Schemas.MCPTool.HeadersPayload(additionalProperties: ["Authorization": "Bearer token"]),
allowedTools: .case1(["browser_navigate"]),
requireApproval: .case2(.never)
)
)
let query = CreateModelResponseQuery(
input: .inputItemList(inputItems),
model: "gpt-5-2025-08-07",
stream: true,
tools: [mcpTool]
)
let stream: AsyncThrowingStream<ResponseStreamEvent, Error> = client.responses.createResponseStreaming(query: query)
// This fails when MCP tool is called
for try await event in stream {
// Processing fails with DecodingError
}
Environment
- Library Version: Latest main branch
- Swift Version: 5.x
- Platform: iOS
- Xcode Version: Latest
Workaround
Currently catching and ignoring the DecodingError allows the stream to continue, but this is not ideal as it may hide other legitimate errors.
- 主要言語
- Swift
- スター
- 2.9k
- フォーク
- 519
- 平均マージ
- 2日 14時間
- マージ済み PR(30日)
- 8
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
MacPaw/OpenAI のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 2 日以内に返信
-
Enable batch promptsオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
MacPaw/OpenAI#73 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 2 日以内に返信
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
メンテナーはふだん 2 日以内に返信
-
Wiz-remediation
難易度 5/5 1週間以上 初心者へのやさしさ 1/100
メンテナーはふだん 2 日以内に返信
似ている issue
-
Requirement is wrongオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
remko/age-plugin-se#25 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
openwatersio/slackwater#495 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100