Repository navigation
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
- 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 typetext/html;profile=mcp-app. - Have the tool return the successful
CallToolResultshown below. The widget consumesparams.structuredContentin itsontoolresulthandler. - Start a Copilot Agent Host chat and invoke the tool.
- Inspect the widget's incoming
ui/notifications/tool-resultnotification.params.structuredContentis absent, and its serialized JSON appears insideparams.content[0].text. - 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:
- Copilot completion handling uses the SDK's
result.contentas a text block. The emitted completion state containssuccess,pastTenseMessage,content, anderror, with nostructuredContentmapping. The history replay mapping has the same omission. toMcpCallToolResult()reconstructs the widget result asreturn { 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
asherjh commentedon Oct 6, 2026
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?
connor4312 commentedon Oct 7, 2026
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
mcp: preserve structured tool results in agent host apps (#340375)