diff --git a/apps/server/src/mcp/McpHttpServer.test.ts b/apps/server/src/mcp/McpHttpServer.test.ts index fa2880f9c364..4c38a66dd11d 100644 --- a/apps/server/src/mcp/McpHttpServer.test.ts +++ b/apps/server/src/mcp/McpHttpServer.test.ts @@ -257,7 +257,13 @@ it.effect("registers annotated tools and preserves authenticated request context Effect.provideService(McpSchema.McpServerClient, client), ); expect(snapshot.isError).toBe(false); - expect(snapshot.content.some((content) => content.type === "image")).toBe(true); + // Regression #11295: inline image content was removed from snapshot + // results because full-resolution base64 PNGs in tool history brick + // sessions when providers reject inline images. + expect(snapshot.content.some((content) => content.type === "image")).toBe(false); + expect(snapshot.content).toEqual([ + { type: "text", text: expect.any(String) }, + ]); expect(snapshot.structuredContent).toMatchObject({ screenshot: { mimeType: "image/png", width: 10, height: 5 }, }); diff --git a/apps/server/src/mcp/McpHttpServer.ts b/apps/server/src/mcp/McpHttpServer.ts index 87975a49de2c..549af65602c8 100644 --- a/apps/server/src/mcp/McpHttpServer.ts +++ b/apps/server/src/mcp/McpHttpServer.ts @@ -182,18 +182,18 @@ const registerPreviewSnapshot = Effect.fn("McpHttpServer.registerPreviewSnapshot height: screenshot.height, }, }; + // Screenshot pixel data is deliberately excluded from the MCP + // tool result. Embedding full-resolution base64 PNGs in tool + // history bricks sessions when providers reject inline images — + // the oversized payload cannot be removed from history and every + // subsequent turn fails. The structured content already carries + // screenshot dimensions and mime type for reference; the client + // preview renders the actual image from its own copy. return Effect.succeed( new McpSchema.CallToolResult({ isError: false, structuredContent: metadata, - content: [ - { type: "text", text: JSON.stringify(metadata) }, - { - type: "image", - data: new Uint8Array(Buffer.from(screenshot.data, "base64")), - mimeType: screenshot.mimeType, - }, - ], + content: [{ type: "text", text: JSON.stringify(metadata) }], }), ); },