Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@aharvard
Copy link
Collaborator

@aharvard aharvard commented Jan 7, 2026

Summary

Fixes #6377

When a tool returns both an mcp-ui resource AND an mcp-apps resource, the UI was rendering both, causing duplicate display.

Changes

  • Updated ToolCallWithResponse to check for the presence of an MCP App resource URI (_meta.ui.resourceUri)
  • When an MCP App resource URI is present, only render the MCP App wrapper (not the inline mcp-ui resource)
  • When no MCP App resource URI is present, render the inline mcp-ui resource as before

This ensures only one rendering path is used based on whether the tool response is intended for MCP Apps or MCP UI.

Testing

  1. Add the MCP server: https://mcp-git-mcp-apps-playground-link-svelte.vercel.app/mcp
  2. Ask to create a playground link with a simple Svelte 5 counter component
  3. Verify the UI is rendered only once (not duplicated)

…865)

Fixes #6364

The draft spec SEP-1865 expects `_meta.ui.resourceUri` (nested object) but
goose was expecting `_meta['ui/resourceUri']` (flat key with slash), which
prevented MCP Apps UI from rendering.

Updated ToolCallWithResponse.tsx to use the correct nested format.
* main:
  fix: update MCP Apps _meta.ui.resourceUri to use nested format (SEP-1865) (#6372)
Copilot AI review requested due to automatic review settings January 7, 2026 20:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes duplicate rendering when a tool returns both mcp-ui and mcp-apps resources by implementing conditional rendering based on the presence of an MCP App resource URI.

  • Adds logic to detect MCP App resource URI in tool requests
  • Makes MCP UI inline rendering and MCP App rendering mutually exclusive
  • Prioritizes MCP App rendering when resource URI is present

}

const requestWithMeta = toolRequest as ToolRequestWithMeta;
const hasMcpAppResourceURI = Boolean(requestWithMeta._meta?.ui?.resourceUri);
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check for MCP App resource URI is incomplete. McpAppWrapper (lines 89-97) checks both toolRequest._meta?.ui?.resourceUri AND toolResponse.toolResult._meta?.ui?.resourceUri as a fallback. However, this code only checks the toolRequest side, which means if the resource URI is only present in the toolResponse, both renderers will still be shown, causing the duplicate rendering issue.

Suggested change
const hasMcpAppResourceURI = Boolean(requestWithMeta._meta?.ui?.resourceUri);
const hasMcpAppResourceURI = Boolean(
requestWithMeta._meta?.ui?.resourceUri ||
(toolResponse?.toolResult as any)?._meta?.ui?.resourceUri
);

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, fixed

@alexhancock alexhancock merged commit 5e116e3 into main Jan 7, 2026
20 checks passed
@alexhancock alexhancock deleted the aharvard/mcp-ui-and-mcp-apps-separation branch January 7, 2026 21:03
alexhancock pushed a commit that referenced this pull request Jan 7, 2026
zanesq added a commit that referenced this pull request Jan 8, 2026
* 'main' of github.com:block/goose:
  Fixed fonts (#6389)
  Update confidence levels prompt injection detection to reduce false positive rates (#6390)
  Add ML-based prompt injection detection  (#5623)
  docs: update custom extensions tutorial (#6388)
  fix ResultsFormat error when loading old sessions (#6385)
  docs: add MCP Apps tutorial and documentation updates (#6384)
  changed z-index to make sure the search highlighter does not appear on modal overlay (#6386)
  Handling special claude model response in github copilot provider (#6369)
  fix: prevent duplicate rendering when tool returns both mcp-ui and mcp-apps resources (#6378)
  fix: update MCP Apps _meta.ui.resourceUri to use nested format (SEP-1865) (#6372)
  feat(providers): add streaming support for Google Gemini provider (#6191)
  Blog: edit links in mcp apps post (#6371)
  fix: prevent infinite loop of tool-input notifications in MCP Apps (#6374)
michaelneale added a commit that referenced this pull request Jan 8, 2026
* main: (31 commits)
  added validation and debug for invalid call tool result (#6368)
  Update MCP apps tutorial: fix _meta structure and version prereq (#6404)
  Fixed fonts (#6389)
  Update confidence levels prompt injection detection to reduce false positive rates (#6390)
  Add ML-based prompt injection detection  (#5623)
  docs: update custom extensions tutorial (#6388)
  fix ResultsFormat error when loading old sessions (#6385)
  docs: add MCP Apps tutorial and documentation updates (#6384)
  changed z-index to make sure the search highlighter does not appear on modal overlay (#6386)
  Handling special claude model response in github copilot provider (#6369)
  fix: prevent duplicate rendering when tool returns both mcp-ui and mcp-apps resources (#6378)
  fix: update MCP Apps _meta.ui.resourceUri to use nested format (SEP-1865) (#6372)
  feat(providers): add streaming support for Google Gemini provider (#6191)
  Blog: edit links in mcp apps post (#6371)
  fix: prevent infinite loop of tool-input notifications in MCP Apps (#6374)
  fix: Show platform-specific keyboard shortcuts in UI (#6323)
  fix: we load extensions when agent starts so don't do it up front (#6350)
  docs: credit HumanLayer in RPI tutorial (#6365)
  Blog: Goose Lands MCP Apps (#6172)
  Claude 3.7 is out. we had some harcoded stuff (#6197)
  ...
wpfleger96 added a commit that referenced this pull request Jan 9, 2026
* main: (89 commits)
  fix(google): treat signed text as regular content in streaming (#6400)
  Add frameDomains and baseUriDomains CSP support for MCP Apps (#6399)
  fix(ci): add missing dependencies to openapi-schema-check job (#6367)
  feat: http proxy support
  Add support for changing working dir and extensions in same window/session (#6057)
  Sort keys in canonical models (#6403)
  added validation and debug for invalid call tool result (#6368)
  Update MCP apps tutorial: fix _meta structure and version prereq (#6404)
  Fixed fonts (#6389)
  Update confidence levels prompt injection detection to reduce false positive rates (#6390)
  Add ML-based prompt injection detection  (#5623)
  docs: update custom extensions tutorial (#6388)
  fix ResultsFormat error when loading old sessions (#6385)
  docs: add MCP Apps tutorial and documentation updates (#6384)
  changed z-index to make sure the search highlighter does not appear on modal overlay (#6386)
  Handling special claude model response in github copilot provider (#6369)
  fix: prevent duplicate rendering when tool returns both mcp-ui and mcp-apps resources (#6378)
  fix: update MCP Apps _meta.ui.resourceUri to use nested format (SEP-1865) (#6372)
  feat(providers): add streaming support for Google Gemini provider (#6191)
  Blog: edit links in mcp apps post (#6371)
  ...
wpfleger96 added a commit that referenced this pull request Jan 9, 2026
* main: (89 commits)
  fix(google): treat signed text as regular content in streaming (#6400)
  Add frameDomains and baseUriDomains CSP support for MCP Apps (#6399)
  fix(ci): add missing dependencies to openapi-schema-check job (#6367)
  feat: http proxy support
  Add support for changing working dir and extensions in same window/session (#6057)
  Sort keys in canonical models (#6403)
  added validation and debug for invalid call tool result (#6368)
  Update MCP apps tutorial: fix _meta structure and version prereq (#6404)
  Fixed fonts (#6389)
  Update confidence levels prompt injection detection to reduce false positive rates (#6390)
  Add ML-based prompt injection detection  (#5623)
  docs: update custom extensions tutorial (#6388)
  fix ResultsFormat error when loading old sessions (#6385)
  docs: add MCP Apps tutorial and documentation updates (#6384)
  changed z-index to make sure the search highlighter does not appear on modal overlay (#6386)
  Handling special claude model response in github copilot provider (#6369)
  fix: prevent duplicate rendering when tool returns both mcp-ui and mcp-apps resources (#6378)
  fix: update MCP Apps _meta.ui.resourceUri to use nested format (SEP-1865) (#6372)
  feat(providers): add streaming support for Google Gemini provider (#6191)
  Blog: edit links in mcp apps post (#6371)
  ...
fbalicchia pushed a commit to fbalicchia/goose that referenced this pull request Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tool returning both mcp-ui and mcp-apps renders twice

3 participants