Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion apps/server/src/mcp/McpHttpServer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
});
Expand Down
16 changes: 8 additions & 8 deletions apps/server/src/mcp/McpHttpServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) }],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Return a bounded screenshot to image-capable providers

For providers/models that accept MCP image blocks, every preview_snapshot now returns only page metadata, so pages whose relevant state is visual-only (canvas output, layout defects, video frames, or other non-semantic content) can no longer be inspected by the agent even though PreviewSnapshotTool still promises a PNG screenshot. The client preview's copy is visible to the user, not to the provider consuming this MCP response; preserve a size-bounded/downscaled image for compatible providers, or omit it only for adapters that cannot accept one.

AGENTS.md reference: AGENTS.md:L69-L72

Useful? React with 👍 / 👎.

}),
);
},
Expand Down
Loading