Claude Desktop strips structuredContent from ui/notifications/tool-result — views built per SDK examples render blank
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- typescript
- 领域
- api
调研方向
使用提供的服务器结果以及在 ontoolresult 中读取 structuredContent 的应用视图,通过 Claude Desktop 1.18286.2 重现该问题。跟踪 tools/call 和 resources/read 之后 ui/notifications/tool-result 的传递;当 structuredContent 按照指定到达视图,且不需要在 content 中重复时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
Summary
Claude Desktop (macOS 1.18286.2, checked 2026-07-07) delivers the ui/notifications/tool-result notification to the app view without the structuredContent field, even when the server's CallToolResult includes it. Every SDK example and pattern reads the view's data from result.structuredContent in ontoolresult, so an app built exactly per the docs mounts, completes the handshake, receives the result, renders nothing, reports ~zero height via auto-resize and is collapsed to an invisible widget. There is no error anywhere: server logs look healthy and the chat just shows no widget.
Environment
- Claude Desktop 1.18286.2, macOS (Darwin 25.5)
@modelcontextprotocol/ext-apps1.7.4,@modelcontextprotocol/sdk1.29.0- Local stdio server, pre-bundled with esbuild; view bundled with vite-plugin-singlefile
- Tool registered via
registerAppToolwith_meta.ui.resourceUri, aninputSchemaand anoutputSchema; resource registered viaregisterAppResourcewithRESOURCE_MIME_TYPE
What the server returns
return {
content: [{ type: "text", text: "…spec as fenced json…" }],
structuredContent: { spec },
_meta: { "weave/spec": spec },
};
tools/list advertises the matching outputSchema (declaring it made no difference, tested both ways).
Evidence
-
Instrumented the view to print its lifecycle into the widget. In Claude Desktop it shows the handshake completing and then:
tool result received but no structuredContent.spec attachedSo the sandbox runs the view,
ui/initializesucceeds, the tool-result notification arrives — withstructuredContentmissing. -
The identical built view under an emulated host (iframe + postMessage, responding to
ui/initializeand then sendingui/notifications/tool-resultwith the fullCallToolResult) renders correctly and reports its size. The app side follows the protocol; the host delivery differs. -
Desktop's MCP server log shows the healthy half:
tools/callreturning normally andresources/readfetching the view HTML. The stripping happens between the host receiving the result and forwarding it to the view. -
A second app on the same machine (single-tool Mermaid viewer built from the SDK examples, verified working end-to-end in Claude Desktop in May 2026) now shows the same symptom for its
structuredContent-dependent path. Its editor still fills viaui/notifications/tool-input, which suggests tool-input is forwarded intact while tool-result is stripped ofstructuredContent.
Expected
Per the spec's data-delivery section, results forwarded to the view include content and optionally structuredContent, with structuredContent/_meta being the channels that do not enter model context. The view should receive structuredContent when the server provided it.
Workaround
Duplicate the payload into the content text (e.g. a fenced JSON block) and parse it in the view when structuredContent is absent. Ugly, but it renders on current Desktop while staying compatible with spec-following hosts.
Possibly related
- #380 (clarifying content vs structuredContent vs
_metavisibility) - #646 (basic-host not forwarding tool-result
_meta)
🤖 Generated with Claude Code
- 主要语言
- TypeScript
- 星标
- 2.9k
- 派生
- 387
- 平均合并
- 3 小时 21 分钟
- 30 天内合并 PR
- 6
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
modelcontextprotocol/ext-apps 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 84/100
modelcontextprotocol/ext-apps#767 ·
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
modelcontextprotocol/ext-apps#742 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 72/100
modelcontextprotocol/ext-apps#711 ·
-
难度 2/5 1-3 小时 新手友好度 65/100
modelcontextprotocol/ext-apps#706 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
modelcontextprotocol/ext-apps#703 · 1 个 reaction ·
查看 modelcontextprotocol/ext-apps 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
难度 2/5 1-3 小时 新手友好度 78/100
-
enhancement
难度 2/5 1-3 小时 新手友好度 68/100
-
calcite-components needs triage refactor
难度 2/5 1-3 小时 新手友好度 75/100
Esri/calcite-design-system#15203 ·
-
难度 2/5 1-3 小时 新手友好度 90/100
danielmiessler/LifeOS#2218 ·