From 5e116e3cbc1014834b2876496beff310cda4f7a3 Mon Sep 17 00:00:00 2001 From: Andrew Harvard Date: Wed, 7 Jan 2026 16:03:19 -0500 Subject: [PATCH] fix: prevent duplicate rendering when tool returns both mcp-ui and mcp-apps resources (#6378) --- ui/desktop/src/components/ToolCallWithResponse.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ui/desktop/src/components/ToolCallWithResponse.tsx b/ui/desktop/src/components/ToolCallWithResponse.tsx index 9fce25ba..bfe8baea 100644 --- a/ui/desktop/src/components/ToolCallWithResponse.tsx +++ b/ui/desktop/src/components/ToolCallWithResponse.tsx @@ -163,6 +163,12 @@ export default function ToolCallWithResponse({ return null; } + const requestWithMeta = toolRequest as ToolRequestWithMeta; + const resultWithMeta = toolResponse?.toolResult as ToolResultWithMeta; + const hasMcpAppResourceURI = Boolean( + requestWithMeta._meta?.ui?.resourceUri || resultWithMeta?.value?._meta?.ui?.resourceUri + ); + return ( <>
{/* MCP UI — Inline */} - {toolResponse?.toolResult && + {!hasMcpAppResourceURI && + toolResponse?.toolResult && getToolResultContent(toolResponse.toolResult).map((content, index) => { const resourceContent = isEmbeddedResource(content) ? { ...content, type: 'resource' as const } @@ -203,7 +210,7 @@ export default function ToolCallWithResponse({ } })} - {sessionId && ( + {hasMcpAppResourceURI && sessionId && (