fix(server): prevent preview_snapshot from bricking sessions with oversized images #11624
ClosedExotic209093(GitHub profile, opens in a new tab)wants to merge 3 commits into
main fromrefs/pull/11624/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
- @@ -184,13 +184,13 @@184184 };185+ // Screenshot pixel data is deliberately excluded from the MCP186+ // tool result. Embedding full-resolution base64 PNGs in tool187+ // history bricks sessions when providers reject inline images —188+ // the oversized payload cannot be removed from history and every189+ // subsequent turn fails. The structured content already carries190+ // screenshot dimensions and mime type for reference; the client191+ // preview renders the actual image from its own copy.185192 return Effect.succeed(186193 new McpSchema.CallToolResult({187194 isError: false,188195 structuredContent: metadata,189- content: [190- { type: "text", text: JSON.stringify(metadata) },191- {192- type: "image",193- data: new Uint8Array(Buffer.from(screenshot.data, "base64")),194- mimeType: screenshot.mimeType,195- },196- ],196+ content: [{ type: "text", text: JSON.stringify(metadata) }],
- apps/server/src/mcp/McpHttpServer.ts lines 408 to 414Resolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -405,3 +405,10 @@405405 },406406 ...(screenshotPath === undefined ? {} : { screenshotPath }),407407 };408+ // Screenshot pixel data is deliberately excluded from the MCP409+ // tool result. Embedding full-resolution base64 PNGs in tool410+ // history bricks sessions when providers reject inline images —411+ // the oversized payload cannot be removed from history and every412+ // subsequent turn fails. The structured content already carries413+ // screenshot dimensions and mime type for reference; the client414+ // preview renders the actual image from its own copy.
juliusmarminge closed this
Sign in to join this conversation.
Bugbot is paused — on-demand spend limit reached
Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.
A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.