screenshot-diff
Compare baseline and current PNG screenshots to detect pixel-visible UI regressions and return a compact diff summary for layout, spacing, color, typography, and rendering changes.
Instructions
Compare two PNG screenshots and return a compact visual-diff summary. Each side is a saved PNG or a live capture from the device. baselinePath + captureCurrent is the common visual-regression flow. Both images must have identical dimensions: save baselines with screenshot scale: 1.0, one per device model. A size difference fails as a dimension mismatch. Use when stable before/after screenshots exist and the expected result is pixel-visible: layout, spacing, color, typography, image/icon rendering, clipping, overflow, or text rendering. Physical iPhones: live captures are device-wide and need no registered app. Returns { summary }, plus diffPath and contextDiffPath when pixels differ. The summary uses normalized [0,1] screen locations matching describe coordinates; diffPath is the full-size diff image and contextDiffPath is a downscaled image for MCP/agent display. Ignores the fixed top status-bar band for both pixel and OCR text comparisons. Fails if the input sources are invalid, PNG files cannot be read, outputDir cannot be written, or the simulator-server / emulator backend is not reachable.
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": {
"udid": "<udid>"
},
"name": "screenshot-diff"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| udid | Yes | Target device id from `list-devices` (iOS UDID or Android serial). | |
| rotation | No | Orientation override for live baseline/current captures. Ignored on physical iPhones. | |
| outputDir | No | Directory where diff artifacts should be written (default: a temp directory). | |
| currentPath | No | Path to the saved current PNG file. Required unless captureCurrent is true; do not pass both. | |
| baselinePath | No | Path to the saved baseline PNG file. Required unless captureBaseline is true; do not pass both. | |
| captureCurrent | No | Capture the current screenshot live from the device, at full resolution, before diffing. Cannot be combined with captureBaseline. | |
| captureBaseline | No | Capture the baseline screenshot live from the device, at full resolution, before diffing. Cannot be combined with captureCurrent. |