Resource content type in MCP tool output is not supported #4785

Closed
opened 2026-02-16 17:45:25 -05:00 by yindo · 2 comments
Owner

Originally created by @antigremlin on GitHub (Jan 11, 2026).

Originally assigned to: @thdxr on GitHub.

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

Originally created by @antigremlin on GitHub (Jan 11, 2026). Originally assigned to: @thdxr on GitHub. ### 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_
yindo added the bug label 2026-02-16 17:45:25 -05:00
yindo closed this issue 2026-02-16 17:45:25 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 11, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #6604: [FEATURE]: MCP Tool Output - The TUI doesn't display MCP tool outputs, which is related to the issue of resource content being discarded since the output isn't being rendered anyway.

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 11, 2026): This issue might be a duplicate of existing issues. Please check: - #6604: [FEATURE]: MCP Tool Output - The TUI doesn't display MCP tool outputs, which is related to the issue of resource content being discarded since the output isn't being rendered anyway. Feel free to ignore if none of these address your specific case.
Author
Owner

@antigremlin commented on GitHub (Jan 11, 2026):

Indeed related to #6604 but distinctly different. Here the problem is ignoring a part of the MCP tool output, rather than not displaying it in the TUI.

@antigremlin commented on GitHub (Jan 11, 2026): Indeed related to #6604 but distinctly different. Here the problem is ignoring a part of the MCP tool output, rather than not displaying it in the TUI.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4785