Repository navigation
Conversation
Tool results can include image attachments (e.g. MCP ImageContent blocks from browser/screenshot tools, or images returned by the read tool), but the web UI never rendered them - they were only forwarded to the model. Show clickable image thumbnails below completed tool calls, for both rendering paths: - ToolPartDisplay (MCP and other non-grouped tools) - ContextToolGroup (read/grep/glob group row) Clicking a thumbnail opens the existing ImagePreview dialog. Closes anomalyco#21227
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
Validated this fix against a shipped OpenCode Desktop build. I ported the exact change (ToolImageAttachments in ContextToolGroup + ToolPartDisplay) onto the Electron renderer bundle and tested it live:
One observation from testing (not a blocker): the server's tool-result image normalization ( Thanks for the fix — looking forward to it landing so I can drop my local patch. |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
|
Also hitting this on opencode web (1.18.5, Docker). Images returned by MCP tools are converted to This PR was closed by the automated cleanup rather than on review, and it already carries an independent verification against a Desktop build in the thread above. Could a maintainer either reopen it, or point at #39817 as the preferred direction so the effort isn't split across two patches? |
Issue for this PR
Closes #21227
Type of change
What does this PR do?
Tool results can carry image attachments (
state.attachmentswith an image mime type) — e.g. MCPImageCo ntentblocks from browser/screenshot tools, or images returned by the built-inreadtool. They are forwarded to the model, but the web UI never renders them.
This PR renders image attachments as clickable thumbnails below completed tool calls; clicking a thumbnail
opens the existing
ImagePreviewdialog.A small shared
ToolImageAttachmentscomponent is used in both tool rendering paths:ToolPartDisplay— MCP tools and other non-grouped toolsContextToolGroup— the read/grep/glob group row, so images produced by thereadtool are visible without expanding the group
Non-image attachments and non-completed tool states render nothing, as before.
How did you verify your code works?
Ran the backend (
bun run --conditions=browser ./src/index.ts serve --port 4096) and the app dev server (bun dev -- --port 4444) locally, then drove the UI headlessly with Playwright:reada PNG file → thumbnail strip appears below the "Exploring · 1 read" group row; clicking it opens the full-size preview dialog.
ImageContentblock → thumbnail appears directly under the
Called mock-img_take_screenshotrow.Also ran
tsgo --noEmit(clean),prettier --check,oxlint(no new issues), and the existingmessage- part.test.ts(6 pass).Screenshots / recordings
MCP tool returning an image:
readtool on an image file (context group row):Clicking a thumbnail opens the full-size preview:
Checklist