fix: add missing id/sessionID/messageID to MCP tool attachments#14345
Merged
rekram1-node merged 1 commit intoanomalyco:devfrom Feb 20, 2026
Merged
fix: add missing id/sessionID/messageID to MCP tool attachments#14345rekram1-node merged 1 commit intoanomalyco:devfrom
rekram1-node merged 1 commit intoanomalyco:devfrom
Conversation
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
MCP tool results (e.g. Playwright screenshots) return attachments without id, sessionID, and messageID fields. This causes downstream Zod validation to fail because MessageV2.FilePart requires these fields. Built-in tools already map attachments to include these fields (line 808-814), but the MCP tool path (line 874) explicitly omits them. This patch applies the same mapping to MCP tool attachments, making both paths consistent. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
6669d35 to
440b0e8
Compare
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
rekram1-node
pushed a commit
that referenced
this pull request
Feb 20, 2026
lacymorrow
added a commit
to lacymorrow/lash
that referenced
this pull request
Feb 22, 2026
* upstream/dev: (476 commits) release: v1.2.9 fix: issue from structuredClone addition by using unwrap (anomalyco#14359) tweak(ui): adjust session feed spacing tweak(ui): tone down reasoning emphasis tweak(ui): refine session feed spacing fix(desktop): restore settings header mask tweak(ui): nudge edited files chevron tweak(ui): stabilize collapsible chevron hover fix: add missing id/sessionID/messageID to MCP tool attachments (anomalyco#14345) Use structuredClone instead of remeda's clone (anomalyco#14351) remove unnecessary deep clones from session loop and LLM stream (anomalyco#14354) fix(web): correct config import path in Korean enterprise docs docs: update providers layout and Windows sidebar label core: remove User-Agent header assertion from LLM test to fix failing test release: v1.2.8 fix(app): black screen on launch with sidecar server chore: generate feat(opencode): support adaptive thinking for claude sonnet 4.6 (anomalyco#14283) feat(tui): add custom tool and mcp call responses visible and collapsable (anomalyco#10649) chore: cleanup ... # Conflicts: # bun.lock # packages/app/package.json # packages/console/app/package.json # packages/console/core/package.json # packages/console/function/package.json # packages/console/mail/package.json # packages/desktop/package.json # packages/enterprise/package.json # packages/extensions/zed/extension.toml # packages/function/package.json # packages/opencode/package.json # packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx # packages/opencode/src/cli/cmd/tui/routes/home.tsx # packages/opencode/src/config/config.ts # packages/opencode/src/tool/lsp.ts # packages/opencode/src/tool/read.ts # packages/plugin/package.json # packages/sdk/js/package.json # packages/slack/package.json # packages/ui/package.json # packages/util/package.json # packages/web/package.json # sdks/vscode/package.json
jonathanmiddleton
pushed a commit
to jonathanmiddleton/opencode
that referenced
this pull request
Mar 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #14355
Type of change
What does this PR do?
MCP tool results (e.g. Playwright
take_screenshot) return attachments withoutid,sessionID, andmessageIDfields. This causes Zod validation to fail onMessageV2.FilePart, and the tool result is silently lost.Built-in tools already map attachments to include these fields (prompt.ts L808-814), but the MCP tool path (L874) explicitly omits them via
Omit<MessageV2.FilePart, "id" | "sessionID" | "messageID">.This patch applies the same
.map()logic to MCP tool attachments, making both paths consistent.Before: Playwright
take_screenshot→ image attachment missing id fields → Zod parse error → tool result lostAfter: Playwright
take_screenshot→ image attachment has id fields → works like built-in toolsHow did you verify your code works?
take_screenshottool — screenshot returns without Zod errorsreadon an image file)MessageV2.FilePartZod validation passes for MCP tool attachmentsScreenshots / recordings
N/A — backend logic change, no UI affected.
Checklist