DecodingError when handling MCP tool calls - type 'mcp_call' not recognized
Los mantenedores suelen responder en 3 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 48/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Swift
- Estrellas
- 2.9k
- Forks
- 519
- Merge medio
- 4 d 9 h
- PR fusionados (30 d)
- 13
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de MacPaw/OpenAI
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 3 días
-
Enable batch promptsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
MacPaw/OpenAI#73 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 3 días
-
Check the HTTP status code for JSON responsesPosiblemente ocupada @mvanhorn la tomó hace 1 día. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
MacPaw/OpenAI#469 · 1 comentario ·
Los mantenedores suelen responder en 3 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
Los mantenedores suelen responder en 3 días
-
Add Batch API supportAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Los mantenedores suelen responder en 3 días
Todos los issues de MacPaw/OpenAI
Issues similares
-
swift.md: `Date(myString, strategy: .iso8601)` example omits `try` — the initializer is throwingAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
-
core: RAC_LLM_OPTIONS_DEFAULT.min_p disagrees with the IDL's annotated defaultPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertobug core p3
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
RunanywhereAI/runanywhere-sdks#1083 ·
Los mantenedores suelen responder en 5 días
-
area: docs eco: swift good first issue help wanted lane: free-agent roadmap size: XS type: docs
Dificultad 1/5 Menos de una hora Aptitud para principiantes 62/100
arminazimi/evergreen#441 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
nightscout/nightguard#368 ·