Skip to content

Inconsistency: Plugin tools cannot return image attachments despite the internal tool system fully supporting them. #21383

Description

@mklikushin

Description

The fromPlugin wrapper in the registry discards any possibility of attachments because the ToolDefinition type constrains execute to Promise. Native tools and MCP tools both support attachments through the same downstream pipeline.

Why it matters: Without attachment support, custom tools are limited to text only output. Use cases like browser automation need to return screenshots for the model to reason about visually. The only current alternatives are MCP or forking, which are disproportionate to a small patch.

Plugins

No response

OpenCode version

v1.3.17

Steps to reproduce

  1. Create .opencode/tool/screenshot-test.ts with an appropriate tool that returns a base64 image
  2. Start bun dev server, create a session, send "Take a screenshot using the screenshot-test tool"
  3. Inspect the message history: the tool part shows output: "data:image/png;base64,..." as plain text with attachments: NONE
  4. Compare with the built-in read tool on any PNG: it returns output: "Image read successfully" with attachments: [{ type: "file", mime: "image/png", url: "data:..." }]

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions