Skip to content

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

@antigremlin

Description

@antigremlin

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions