Repository navigation
fix: deliver MCP tool images on the held Run as McpImageContent - #46
Merged
Merged
Conversation
nkoynov
force-pushed
the
fix/mcp-image-results
branch
from
October 5, 2026 18:19
61e981a to
285275a
Compare
This was referenced Oct 5, 2026
Owner
CONTRIBUTING checklistPer CONTRIBUTING.md, please address:
Live A/B and |
Contributor
Author
|
Closing per the new contribution policy. This fix and the others we had open are maintained in our fork: https://github.com/nkoynov/cursor-opencode-provider |
Owner
|
Reopening to land a quality-standard rebase stacked on #42 (MCP |
oakimov
force-pushed
the
fix/mcp-image-results
branch
from
October 7, 2026 23:30
285275a to
e974bf2
Compare
Owner
|
CONTRIBUTING checklist (tip e814095):
Live A/B: OC1.18.35 + OC2.0.24 pass (mcp_result image items); warm cache ~99.9% rawReadVsPriorContext. Merge after #42. |
OpenCode moves the images an MCP tool returns into a trailing `Attached media from tool result:` user message. Since oakimov#34 that message no longer forces a fresh Run, so the held Run got the MCP result as text only and the model saw the image at the earliest after the next user message. The README gave the reason as "Cursor's exec-result channel has no image field", but agent.v1 has one: Cursor CLI 2026.10.01 declares `McpImageContent|1 data 12|2 mime_type 9` and `McpToolResultContentItem|1 text #0 content|2 image oakimov#1 content` in `agent/v1/mcp_exec_pb.js`, and its MCP executor appends every MCP `image` item as `{content: {case: "image", value: McpImageContent{data, mimeType}}}`. Declare the type and the oneof case, and append the images attributed to an `mcp_result` (the trailing-media path from the read-image change) as image items after the text, as the CLI does. Update the README and AGENTS.md: only results without an image field (shell, write) still wait for the history path.
Normalize host mime/uri and OpenCode 1 type:media tool parts before ReadSuccess/McpImageContent decode, and log continuation prompt-tail media counts for cache/live diagnosis.
oakimov
force-pushed
the
fix/mcp-image-results
branch
from
October 8, 2026 12:28
f5bd930 to
b82d8ee
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #45. Stacked on #42 (
ReadSuccess.datafor image reads).MCP tool images that OpenCode moves into the trailing
Attached media from tool result:message reached Cursor only as history after the next user message. Cursor CLI's MCP executor appends each image asMcpImageContentonMcpToolResultContentItemfield 2 after the success text. This PR does the same on held-Run continuations.Changes
McpImageContent+imagecase inmessages.tsmcp_resultsuccess: text items, then image items (CLI order); write/shell stay text-onlymime/uri, OpenCode 1type: media) before decodecursor_image_save(MCP content items, not read/write exec)Tests
messages.test.ts,tools.test.ts,continuation-session.test.ts,image-input.test.tsbun test/typecheck/build/ architecture gate greenLive A/B + cache (quality bar)
mediaParts=1,continuation: 1 tool-result image(s) on mcp_result(stdio badge MCP,gpt-5.4-mini)--standalone+ localdist/)continuity=warm, ~99.9%rawReadVsPriorContexton both hostsMethod: automated
opencode runagainst localdist/(not interactive TTY).CONTRIBUTING checklist
[Unreleased]Fixed + credit @nkoynov (fix: deliver MCP tool images on the held Run as McpImageContent #46 / MCP image results reach the model only after the next user message #45)Merge after #42.