You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Code Mode execute should return images/attachments to the model #55072
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
A tool that returns an image (screenshot, chart, etc.) called inside Code Mode execute only gives text back to the model. To see the image, the agent needs a second call with the normal tool (e.g. read). That costs two round trips for one action.
Proposal
Let execute forward image/file attachments from nested tool results into the execute result, so the model sees them in the same call. Also allow returning an image explicitly from the script, so a script can pick which images to show.
constshot=awaittools.browser.screenshot({ url })returnshot// image shows up in the model context
Related: #55087 (built-in tools like shell in Code Mode).
Thanks for the suggestion! You're asking for images and other attachments from tools called inside Code Mode execute to reach the model in the same call, plus a way for a script to return or pick specific images explicitly.
On current v2 (e.g. 2.0.27), part of this already works. execute collects file attachments from nested tool calls and passes them to the model with its result. It only does this when the tool returns the attachment as a base64 data: URI, which is what MCP image content and read produce. Attachments given as https: or file: URIs are currently dropped (see #47458). If you're on v2 and a screenshot tool still only gives back text, could you tell us which tool it is (MCP server or plugin) and your opencode --version?
There's no way yet for a script to return an image explicitly or choose which collected images are shown; every nested attachment is forwarded. As a partial workaround, a script can call tools.read({ path }) on a saved image to put it in the result. Maintainers will consider the explicit-return and selection part.
My use case is to use a bash cli to screenshot and add that image into the context in one tool call. Now it requires two, adding support for a method read into the js context would allow this to be done faster
Activity
opencode-agent commentedon Oct 13, 2026
Thanks for the suggestion! You're asking for images and other attachments from tools called inside Code Mode
executeto reach the model in the same call, plus a way for a script to return or pick specific images explicitly.On current v2 (e.g. 2.0.27), part of this already works.
executecollects file attachments from nested tool calls and passes them to the model with its result. It only does this when the tool returns the attachment as a base64data:URI, which is what MCP image content andreadproduce. Attachments given ashttps:orfile:URIs are currently dropped (see #47458). If you're on v2 and a screenshot tool still only gives back text, could you tell us which tool it is (MCP server or plugin) and youropencode --version?There's no way yet for a script to return an image explicitly or choose which collected images are shown; every nested attachment is forwarded. As a partial workaround, a script can call
tools.read({ path })on a saved image to put it in the result. Maintainers will consider the explicit-return and selection part.Related issues:
https:/file:URIs (only base64 data URIs are kept)executeintegrates with the tool APIs, including attachmentsremorses commentedon Oct 13, 2026
My use case is to use a bash cli to screenshot and add that image into the context in one tool call. Now it requires two, adding support for a method read into the js context would allow this to be done faster