opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Resource content type in MCP tool output is not supported

Open antigremlin opened this issue 3 days ago • 2 comments

Description

OpenCode currently ignores MCP tool outputs with type: "resource". This prevents agents from receiving data from tools that return embedded resources, such as the get_file_contents tool in the official github-mcp-server.

When using get_file_contents, the agent receives only the status message (e.g., "successfully downloaded...") but the actual file content—returned as a resource item—is discarded.

To fix, update the MCP tool execution logic to handle resource content items so that:

  1. Text resources are passed to the agent as visible output.
  2. Binary/Blob resources are attached as files.

This will restore functionality for standard MCP servers that rely on embedded resources for content delivery.

This is a known pattern in the GitHub MCP server implementation (see github/github-mcp-server#607).

Plugins

None

OpenCode version

1.1.13

Steps to reproduce

  1. Configure the github-mcp-server in opencode. It's enough to enable the repos toolset and read-only mode, with a readonly PAT.
  2. Ask the agent to read a file from a GitHub repository (e.g., "Read CONTRIBUTING.md from anomalyco/opencode").
  3. The agent will report success or confusion, as it receives the tool output [{"type": "text", "text": "successfully downloaded..."}, {"type": "resource", "resource": {...}}].
  4. Export the session to confirm the file content is not there.

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

antigremlin avatar Jan 11 '26 23:01 antigremlin