anomalyco / anomalyco/opencode

Native tool content results are downgraded to JSON

Open
#46,811 0 comments 0 reactions 1 assignee View on GitHub

@rekram1-node is already working on this.

Since Sep 2, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

LLMNative.request can receive a tool result whose output has type: "content". In packages/opencode/src/session/llm/native-request.ts, that result is currently downgraded to json. AI SDK media items inside the content also use { type: "media", mediaType, data }, while the native runtime expects file content with { type: "file", uri, mime }.

As a result, native tool calls that return text/media content lose the content result type and can produce a payload the native runtime cannot consume.

Steps to reproduce
  1. Pass a tool result with output.type === "content" containing a media item through the native request path.
  2. Inspect the tool result sent to the native runtime.
  3. The result is represented as JSON instead of content and the media item is not canonicalized to native file content.
Expected behavior

Preserve resultType: "content" and convert media items to native file content, using a data URI for inline media data.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.