Skip to content

[MCP Apps] Nested MCP calls inside functions.exec do not create renderable widget items #36765

Open

Description

@Ethereal49

Summary

Codex Desktop successfully calls an MCP App tool and receives valid widget metadata, structured content, and HTML. However, when the MCP call is nested inside functions.exec, the thread records only the outer custom tool call.

The nested MCP result does not become a top-level McpToolCall thread item, so the widget renderer has nothing to mount. The result is serialized as text instead of being displayed as an interactive MCP App card.

This was reproduced with the OpenAI-curated Apple Music connector.

Environment

  • Codex Desktop: 26.727.51351 (build 6119)
  • Bundled Codex CLI: 0.146.0-alpha.9.2
  • Platform: macOS, Apple Silicon
  • Connector: Apple Music

No account identifiers, thread identifiers, local paths, playlist contents, or raw logs are included in this report.

Steps to reproduce

  1. Open a Codex Desktop task.
  2. Invoke the Apple Music App and ask it to generate a playlist.
  3. Codex calls apple_music_get_track_details_batch through functions.exec.
  4. The Apple Music request succeeds and returns matched catalog tracks.
  5. Observe that no Apple Music card is rendered in the conversation.

Actual behavior

The MCP App call succeeds:

  • structuredContent contains body and status.
  • Tool-result _meta contains appleweb/html.
  • The result contains a createPlaylistAction.
  • The widget descriptor contains both _meta.ui.resourceUri and _meta["openai/outputTemplate"].
  • mcpServer/resource/read succeeds for the referenced widget resource.

However:

  • The rollout contains a top-level custom_tool_call for functions.exec.
  • The Apple Music request appears only as a nested mcp_tool_call_end event.
  • No top-level McpToolCall / ThreadItem::McpToolCall is created.
  • No widget renderer or widget-data initialization event follows.
  • The HTML/result envelope is surfaced as ordinary text.
  • No interactive card appears.

Sanitized event shape:

custom_tool_call
  name: exec
  └── nested mcp_tool_call_end
        server: codex_apps
        tool: apple_music_get_track_details_batch
        result: Ok
        structuredContent: [body, status]
        _meta: [appleweb/html]

There is no corresponding top-level event shaped like:

McpToolCall
  appContext.resourceUri: ui://widget/get-track-details-batch.html

Expected behavior

A successful nested MCP App result should either:

  1. Be promoted to a renderable top-level MCP tool-call item carrying the App resource context; or
  2. Have its complete MCP result envelope forwarded through functions.exec to the widget renderer.

The forwarded data should preserve at least:

  • content
  • structuredContent
  • top-level _meta
  • ui.resourceUri
  • openai/outputTemplate
  • App/widget context and action-bridge identifiers
  • tool ID and call ID

The Apple Music widget should then render as an interactive card.

Why this appears to be a Codex transport issue

The connector and resource both appear healthy:

  • The catalog call succeeds.
  • The widget descriptor is present.
  • The widget HTML resource can be read successfully.

The failure occurs after the nested MCP result is returned but before Codex creates the UI/thread item required by the renderer.

Retrying the operation does not change this event shape.

Related issues

This may share the result-envelope loss described in #33717, but this reproduction differs because no usable card is mounted at all: the nested MCP call never becomes a top-level renderable thread item.

Suggested fix

Preserve nested MCP App results as first-class MCP call records instead of flattening them into the outer functions.exec text result.

Alternatively, add explicit support in the Codex client for forwarding nested MCP App result envelopes into the widget-rendering pipeline.

Activity

  1. added
    bug
    app
    mcp
    tool-calls
    on Aug 3, 2026
  2. github-actions commented on Aug 3, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  3. TyceHerrman commented on Aug 11, 2026

    @TyceHerrman

    reproduced the same nested-result boundary with the official GitHub connector without relying on widget rendering. The connector call succeeded and its raw result contained:

    • content: only the placeholder "Action completed."
    • structuredContent: the correct GitHub search results

    After the nested MCP call returned through functions.exec, the model saw only the placeholder and concluded that no usable results were returned. This suggests the impact is broader than missing MCP App cards: ordinary connector data can also become invisible at the nested-result forwarding boundary.

    Related implementation evidence:

  4. sepivip commented on Aug 21, 2026

    @sepivip

    Reproduced on Windows with a custom remote MCP App, adding a second transport/platform data point.

    Environment:

    • Codex Desktop (Microsoft Store): 26.818.3698.0, Windows x64
    • Codex CLI: 0.145.0
    • MCP transport: Streamable HTTP
    • Authentication: OAuth
    • apps = true
    • enable_mcp_apps = true

    The MCP server exposes balance_get_stocks with an MCP App resource (_meta.ui.resourceUri) and matching text/html;profile=mcp-app resources. The same deployed endpoint renders its workspaces in the official @modelcontextprotocol/ext-apps basic host.

    In Codex Desktop, a successful call routed through functions.exec returned the complete stock result as JSON text, but no interactive widget was mounted. The user-visible result was the flattened outer custom-tool output rather than an MCP App card.

    This reproduces the issue with a third-party Streamable HTTP/OAuth server on Windows, rather than a first-party connector on macOS. No credentials, tenant identifiers, or business data are included here.

  5. johnsilvavlogs commented on Oct 7, 2026

    @johnsilvavlogs

    Additional reproduction on October 6, 2026, with a successful library-write comparison in ChatGPT web.

    Environment

    • Installed macOS desktop app: 26.930.61225, build 13232 (com.openai.codex, now displayed as ChatGPT).
    • macOS 26.5.2; uname -mprs: Darwin 25.5.0 arm64 arm.
    • Codex model: GPT-6.1 Sol, Extra High.
    • OpenAI-curated Apple Music plugin: 1.0.0, installed, enabled, and connected. Its app permission follows the default “Allow low-risk actions.”

    Codex observation

    In a fresh Codex task, the full deferred-tool registry exposed apple_music_search and apple_music_get_track_details_batch, with no model-callable playlist-write tool. The batch description explicitly instructs the assistant to present a draft and the “Open Playlist in Apple Music” button.

    The following nested call succeeded with structuredContent.status = 200 and two canonical tracks:

    const result = await tools.mcp__codex_apps__apple_music_get_track_details_batch({
      title: "TESTE Codex Apple Music • 2026-10-06",
      description: "Playlist pequena para verificar o fluxo oficial do plugin Apple Music no Codex.",
      storefront: "br",
      l: "pt-BR",
      trackTitles: ["Something About Us - Daft Punk", "La femme d'argent - Air"]
    });
    text(result);

    Codex displayed the tool activity and expandable text/JSON result, but no playlist card or creation button. I also repeated the call while printing only a short status summary instead of the raw result; it still returned valid track data. I could not complete a second native visual inspection, so I am not claiming that this variant independently rules out serialization as the cause.

    Control test: the plugin can write through its widget

    In a separate Chrome tab, I opened the same plugin's official Try in chat flow on ChatGPT web and requested the same two-track draft. The response rendered an Apple Music widget containing both tracks and the localized “Criar playlist no Apple Music” button.

    Clicking that button changed the widget to “Adicionado à sua biblioteca.” The confirmation persisted after reloading the conversation. This test used the plugin's own UI, without AppleScript, native Music app automation, or a credential-store lookup.

    The public widget bundle loaded in this test contains a separate create-playlist-from-ids action, called through window.openai.callTool. Its creation handler sets isPlaylistInLibrary only when structuredContent.status === 201. That write action was absent from the model-visible tool registry in the Codex task.

    Impact and remaining uncertainty

    When the widget is missing, the user loses the plugin's actual save action, and the assistant can incorrectly conclude that the integration is read-only from the two exposed catalog tools. The successful widget test contradicts that conclusion.

    This observation is consistent with the issue, but I did not independently trace the renderer or establish whether code-mode result forwarding, desktop rendering, or another client boundary is responsible in this version. Expected behavior is to preserve access to the plugin's creation UI, or provide an explicit supported equivalent when the client cannot render it.

    The test playlist was retained; native Music app synchronization was not inspected. No account identifiers, private conversation links, credentials, or raw session logs are included in this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appbugmcptool-calls

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions