Skip to content

MCP Apps: Agent Host drops structuredContent from tool-result notifications #340165

Closed

Description

  • Copilot Chat Extension Version: 0.69.0
  • VS Code Version: 1.141.0 (2a59476c9bfcb90b3ddc372c36762471b7dfad1c)
  • OS Version: Windows 11 ARM64, build 10.0.26310.0
  • Feature (e.g. agent/edit/ask mode): Agent mode, MCP Apps, Copilot Agent Host (agent-host-copilotcli)
  • Selected model (e.g. GPT 4.1, Claude 3.7 Sonnet): GPT-5.6 Sol (gpt-5.6-sol)
  • Logs: Sanitized runtime excerpts and tool-result payloads below. Tenant IDs, session IDs, agent IDs, and service-specific metadata are omitted or replaced with example values.

Summary

A successful MCP Apps tool returns both text content and a separate structuredContent object. In a Copilot Agent Host session, the widget receives a ui/notifications/tool-result notification containing a combined text block, with structuredContent absent. Widgets that validate their opening data consequently receive undefined and fail.

The same server and widget work when the chat is explicitly started with workbench.action.chat.newLocalChat.

Steps to Reproduce

  1. Configure a stdio MCP server exposing a widget-bearing tool, such as open_accent_color. The tool declares _meta.ui.resourceUri, and the referenced resource is served with MIME type text/html;profile=mcp-app.
  2. Have the tool return the successful CallToolResult shown below. The widget consumes params.structuredContent in its ontoolresult handler.
  3. Start a Copilot Agent Host chat and invoke the tool.
  4. Inspect the widget's incoming ui/notifications/tool-result notification. params.structuredContent is absent, and its serialized JSON appears inside params.content[0].text.
  5. Invoke the same tool in an explicit Local chat. The widget opens successfully.

Server result

MCP Inspector confirms that the server returns separate text and structured data. This is the result object, with identifying metadata removed:

{
  "content": [
    {
      "type": "text",
      "text": "Opened the accent-color editor."
    }
  ],
  "structuredContent": {
    "titleId": "example-title",
    "branding": null
  },
  "isError": false
}

Notification received by the widget

{
  "jsonrpc": "2.0",
  "method": "ui/notifications/tool-result",
  "params": {
    "content": [
      {
        "type": "text",
        "text": "Opened the accent-color editor.\n\n{\"titleId\":\"example-title\",\"branding\":null}"
      }
    ]
  }
}

The DevTools object also shows isError: undefined, which is omitted by JSON serialization.

Expected behavior

The widget receives the original structured object in params.structuredContent, including valid null-valued properties, so it can initialize its UI.

Actual behavior

params.structuredContent is undefined. Parsing it with the widget's object schema produces:

Invalid input: expected object, received undefined

The schema accepts branding: null; the missing root payload causes the failure.

Logs

Selected excerpts from the failing session, with the session identifier redacted (timestamps are local, UTC-07:00):

2026-10-06 14:37:54.452 [info] [AgentHost] _invokeAgent called for resource: agent-host-copilotcli:/<session-id>
2026-10-06 14:40:33.132 [info] [Copilot:<sdk-session-id>] Tool started: ess-landing-page-config-open_accent_color

The widget notification above was captured from DevTools. The server result was captured independently through MCP Inspector. Full log files and screenshots contain tenant-specific data, so the relevant excerpts are included inline.

Source findings

The following mappings in the affected VS Code commit omit the structured result:

  1. Copilot completion handling uses the SDK's result.content as a text block. The emitted completion state contains success, pastTenseMessage, content, and error, with no structuredContent mapping. The history replay mapping has the same omission.
  2. toMcpCallToolResult() reconstructs the widget result as return { content, isError: isError || undefined };.

The widget notification sender forwards that reconstructed result unchanged. The Local MCP path retains the original CallToolResult for the widget.

The exact SDK runtime code that concatenates the success text and serialized JSON has not been isolated, nor was the incoming SDK event captured to confirm whether its optional structuredContent field was populated. The identified VS Code mappings omit that field even when it is available.

Workaround and impact

Explicitly starting a Local chat with workbench.action.chat.newLocalChat works. Workspace preferences favoring Local plus a reload did not change the selected runtime for the affected chat. The explicit command is hidden from the Command Palette in this build (f1: false), so invoking it required assigning a shortcut.

This blocks MCP Apps that need structured opening data and makes distributing them to consumers dependent on a runtime-specific workaround.

Related issue

Issue 290063 - MCP: structuredContent in tool result overrides content[].text sent to model concerns model-facing text handling. This report concerns the structured payload delivered to the MCP App iframe.

Activity

  1. asherjh commented on Oct 6, 2026

    @asherjh
    Author

    Connor Peet (@connor4312) This is related to the mapping added in #321016 which doesn't forward structuredContent - was that an intentional omission or can it be added?

  2. connor4312 commented on Oct 7, 2026

    @connor4312
    Member

    thanks for the issue, I had raised a requirement on the copilot SDK to pass structuredContent through properly but forgot to follow up after they did so

  3. added
    bug
    on Oct 7, 2026
  4. added
    unreleased
    on Oct 7, 2026
  5. added this to the 1.142.0 milestone on Oct 7, 2026
  6. added
    insiders-released
    and removed
    unreleased
    on Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

buginsiders-releasedverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions