Skip to content

fix(mcp): support resource content type in MCP tool output#7879

Merged
rekram1-node merged 1 commit into
anomalyco:devfrom
antigremlin:feat/mcp-resource-support
Jan 12, 2026
Merged

fix(mcp): support resource content type in MCP tool output#7879
rekram1-node merged 1 commit into
anomalyco:devfrom
antigremlin:feat/mcp-resource-support

Conversation

@antigremlin

Copy link
Copy Markdown
Contributor

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.

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@rekram1-node rekram1-node merged commit 8b9a85b into anomalyco:dev Jan 12, 2026
2 checks passed
triklozoid pushed a commit to triklozoid/opencode that referenced this pull request Feb 2, 2026
xywsxp pushed a commit to xywsxp/opencode that referenced this pull request Apr 24, 2026
Rwanbt pushed a commit to Rwanbt/opencode that referenced this pull request May 5, 2026
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
avion23 pushed a commit to avion23/opencode that referenced this pull request Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resource content type in MCP tool output is not supported

2 participants