Repository navigation
Description
When an MCP tool returns an image (a screenshot or a status badge), the model gets only the tool's text. It sees the image at the earliest as a history image after the next user message.
Live repro (OpenCode 2.0.22 in T3, Claude Opus 5.5 1M, provider main f65ffc7): a local stdio MCP server whose get_status_badge tool returns a PNG with a build number. The model is asked for the number.
mainreplied: "The badge image didn't come through in that result, so I'll try fetching it through Code Mode to get the raw image data." It then decoded the PNG in the shell: 13 tool calls, 68 s.
Why: OpenCode moves tool-result media into a trailing Attached media from tool result: user message. Since #34 that message no longer forces a fresh Run, so the held Run receives text only. The README gives the reason as: "Held-open continuation results remain text-only because Cursor's exec-result channel has no image field."
agent.v1 does have an image field for MCP results. Cursor CLI 2026.10.01-e373342 declares these types in ../proto/dist/generated/agent/v1/mcp_exec_pb.js (type prefix agent.v1., compact descriptors; 12 = bytes, 9 = string):
McpImageContent|1 data 12|2 mime_type 9
McpToolResultContentItem|1 text #0 content|2 image #1 content
McpSuccess|1 content #0*|2 is_error 8|3 structured_content #1|4 system_reminders #2*
Its MCP executor turns every MCP image item into an image content item:
else if("image"===t){const t=e,r=Buffer.from(t.data,"base64"),n=await Va(r);
p.push(new Qa._Z({content:{case:"image",value:new Qa.do({data:n.data,mimeType:n.mimeType})}}))}Va resizes the image if needed. OpenCode 2 already bounds images before they reach the provider.
Proposed fix: declare McpImageContent and the image case of McpToolResultContentItem, and append the images attributed to an mcp_result as image items after its text, the way the CLI sends them. This builds on the read-image PR (#42), which attributes the trailing media to the step's result. Only results without an image field (shell, write) would still wait for the history path, and the README limitation would be narrowed to those.
With that change, the same repro takes 2 tool calls (token + badge) and 12 s, with the correct number. PR: #46
Activity
nkoynov commentedon Oct 7, 2026
Closing per the new contribution policy. This is fixed in our fork: https://github.com/nkoynov/cursor-opencode-provider
fix: deliver host notes as Cursor postToolUse hook context
fix: steer host notes into the running Cursor turn
fix: steer host notes into the running Cursor turn
fix: steer host notes into the running Cursor turn