Compare screenshots
compare_screenshotsCompare two pages or screenshots to verify a change did what you intended and nothing else moved; returns changed-pixel percentage, bounding box, and diff image.
Instructions
Visual diff of two pages or two existing screenshots. Use it to verify a change did what you intended and nothing else moved: before/after a deploy, staging vs production, or one page at two points in time. Each side is either {url} (captured now) or {screenshot_url} (an earlier GetScreenshot result, reused at no cost; it is checked before any capture is spent). To compare a page across a change, capture it first, make the change, then pass the earlier screenshot_url as before and the page url as after. Returns the percentage of changed pixels, the bounding box of the changed area, and a diff image: the after image dimmed, changed pixels in magenta, a red rectangle around the changed area. When nothing changed no image is attached. Costs 1 screenshot of the monthly quota per side given as url (0 to 2 per call). Both sides are captured with the same viewport options. Takes about 9-25 seconds when it captures. Limits: pages must be publicly reachable. At most the top 2,400 px are compared (at up to 1280 px wide); for a lower part of a long page, capture that part of both versions with capture_screenshot and element, then compare the two screenshot_url values. Animations, ads and rotating content show up as differences; hide them with hide_selectors.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"before": "<before>",
"after": "<after>"
},
"name": "compare_screenshots"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| after | Yes | The "after" image. Provide exactly one of url or screenshot_url. | |
| width | No | Viewport width in CSS pixels. API default 1280. Ignored when device is set. | |
| before | Yes | The "before" image. Provide exactly one of url or screenshot_url. | |
| device | No | Device preset: sets the viewport and, for phones, a mobile user agent. Overrides width and height. iphone* and pixel* are phones, ipad* are tablets, the rest are fixed desktop sizes. | |
| height | No | Viewport height in CSS pixels. API default 800. Ignored when device is set. | |
| wait_ms | No | Extra wait in milliseconds after load, before the capture. API default 2000. Raise it for late animations or client-side rendering. | |
| full_page | No | Capture whole pages instead of the viewport. Applies to sides given as url. | |
| threshold | No | Per-pixel colour tolerance from 0 (any difference counts) to 1 (nothing counts). Default 0.1 ignores anti-aliasing noise. | |
| wait_until | No | When the page counts as loaded. API default "networkidle2". Use "domcontentloaded" for heavy or slow sites (fastest, most reliable); "networkidle0" waits for all network activity to stop. | |
| hide_selectors | No | CSS selector(s) to hide in both captures. Use it to remove things that change on every load (ads, carousels, timestamps) so they do not show up as differences. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| after | Yes | ||
| before | Yes | ||
| images | Yes | One entry per inline image, in the same order as the image blocks. | |
| compared | Yes | Size both images were normalised to before comparing. | |
| warnings | Yes | Things worth knowing about this result, for example an error status from the page. | |
| identical | Yes | True when no compared pixel differs and both images have exactly the same width and height. | |
| threshold | Yes | ||
| truncated | Yes | True when images were requested and some slices were left out, because of max_slices or the inline size limit. Always false with return: "url_only", where no image is attached by request. | |
| bounding_box | Yes | Smallest rectangle containing all changed pixels, in comparison-image pixels. Null when nothing changed. | |
| size_changed | Yes | True when the two images differ in size, for example the page got taller. | |
| total_pixels | Yes | ||
| total_slices | Yes | How many slices the whole image needs at this detail level, whether or not they are attached. With return: "url_only" this is how many a normal call would produce. | |
| changed_pixels | Yes | ||
| changed_percent | Yes | Share of compared pixels that differ, 0-100. | |
| expires_in_days | Yes | Stored files are deleted after this many days. | |
| estimated_image_tokens | Yes | Approximate total vision tokens of the inline images. |