[PR #7879] fix(mcp): support resource content type in MCP tool output #12547

Closed
opened 2026-02-16 18:17:27 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/7879

State: closed
Merged: Yes


What does this PR do?

This PR adds support for resource content types in MCP tool outputs. Previously, OpenCode ignored these, causing tools like github-mcp-server's get_file_contents to return empty results to the agent.

  • Updated MCP.tools() in packages/opencode/src/session/prompt.ts to process contentItem.type === "resource".
  • Text resources are now appended to the tool output.
  • Blob resources are attached as file parts.

Closes #7878

How did you verify your code works?

  • Verified with github-mcp-server by reading a file from a repository. The agent now correctly receives the file content.
  • Ran bun typecheck.
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/7879 **State:** closed **Merged:** Yes --- ### What does this PR do? This PR adds support for `resource` content types in MCP tool outputs. Previously, OpenCode ignored these, causing tools like `github-mcp-server`'s `get_file_contents` to return empty results to the agent. - Updated `MCP.tools()` in `packages/opencode/src/session/prompt.ts` to process `contentItem.type === "resource"`. - Text resources are now appended to the tool output. - Blob resources are attached as file parts. Closes #7878 ### How did you verify your code works? - Verified with `github-mcp-server` by reading a file from a repository. The agent now correctly receives the file content. - Ran `bun typecheck`.
yindo added the pull-request label 2026-02-16 18:17:27 -05:00
yindo closed this issue 2026-02-16 18:17:27 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12547