fix(server): text-only browser snapshots no longer hang on hidden tabs #21494
ClosedByntham(GitHub profile, opens in a new tab)wants to merge 3 commits into
main fromrefs/pull/21494/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:M
- apps/server/src/mcp/toolkits/preview/tools.ts line 142OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -139,4 +139,4 @@139139 export const PreviewSnapshotTool = safeBrowserTool(140140 Tool.make("preview_snapshot", {141141 description:142- "Inspect a page before interacting. Pass tabId to inspect a specific tab, including one the user opened (see preview_status tabs), even while they control it; omit it to use this agent session's current tab, or the tab the user is viewing when you have none. Returns page state, semantic elements, diagnostics, action history, and screenshot dimensions. Server snapshots include an accessibilityTree with refs; pass locator=aria-ref=<ref> to target one exact element, including inside frames. Refresh refs after navigation, another snapshot, or human takeover. The text is capped near 20 KB and lists what it omitted; use preview_evaluate to read more. Set includeImage=true only when you need to see the page; the image stays in tool history. Set save=true to write the PNG to disk and get back only the url and screenshotPath. Embed that path in your reply as  so the user sees it. This is the only way to show the user a screenshot; the image in the tool result is not142+ "Inspect a page before interacting. Pass tabId to inspect a specific tab, including one the user opened (see preview_status tabs), even while they control it; omit it to use this agent session's current tab, or the tab the user is viewing when you have none. Returns page state, semantic elements, diagnostics, and action history, plus screenshot dimensions when includeImage or save is set. Server snapshots include an accessibilityTree with refs; pass locator=aria-ref=<ref> to target one exact element, including inside frames. Refresh refs after navigation, another snapshot, or human takeover. The text is capped near 20 KB and lists what it omitted; use preview_evaluate to read more. Set includeImage=true only when you need to see the page; the image stays in tool history. Set save=true to write the PNG to disk and get back only the url and screenshotPath. Embed that path in your reply as  so the user sees it. This is the only way to show the user a screenshot
Byntham(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.

Approvability#
Verdict: Needs Human Approval
Macroscope's review found this PR requires human approval — This PR changes the default preview_snapshot behavior: screenshots are no longer captured or returned unless explicitly requested via includeImage or save. The change is focused and tested, but the product-default change warrants human review.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).