Description
MCP tool results (e.g., Playwright take_screenshot) return attachments without id, sessionID, and messageID fields, causing downstream Zod validation failure on MessageV2.FilePart.
Steps to Reproduce
- Configure an MCP server (e.g., Playwright MCP)
- Use a tool that returns file attachments (e.g.,
take_screenshot)
- The attachment is missing
id, sessionID, and messageID fields
- Zod parse error occurs and the tool result is lost
Expected Behavior
MCP tool attachments should include id, sessionID, and messageID fields, consistent with built-in tool attachments.
Actual Behavior
The MCP tool path in prompt.ts explicitly omits these fields (Omit<MessageV2.FilePart, "id" | "sessionID" | "messageID"> at L874), while built-in tools correctly map them (L808-814).
Additional Context
Built-in tools already have the correct mapping at packages/opencode/src/session/prompt.ts lines 808-814. The fix is to apply the same .map() to MCP tool attachments.
Description
MCP tool results (e.g., Playwright
take_screenshot) return attachments withoutid,sessionID, andmessageIDfields, causing downstream Zod validation failure onMessageV2.FilePart.Steps to Reproduce
take_screenshot)id,sessionID, andmessageIDfieldsExpected Behavior
MCP tool attachments should include
id,sessionID, andmessageIDfields, consistent with built-in tool attachments.Actual Behavior
The MCP tool path in
prompt.tsexplicitly omits these fields (Omit<MessageV2.FilePart, "id" | "sessionID" | "messageID">at L874), while built-in tools correctly map them (L808-814).Additional Context
Built-in tools already have the correct mapping at
packages/opencode/src/session/prompt.tslines 808-814. The fix is to apply the same.map()to MCP tool attachments.