Skip to main content
Glama

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

NameRequiredDescriptionDefault
udidYesTarget device id from `list-devices` (iOS UDID or Android serial).
rotationNoOrientation override for live baseline/current captures. Ignored on physical iPhones.
outputDirNoDirectory where diff artifacts should be written (default: a temp directory).
currentPathNoPath to the saved current PNG file. Required unless captureCurrent is true; do not pass both.
baselinePathNoPath to the saved baseline PNG file. Required unless captureBaseline is true; do not pass both.
captureCurrentNoCapture the current screenshot live from the device, at full resolution, before diffing. Cannot be combined with captureBaseline.
captureBaselineNoCapture the baseline screenshot live from the device, at full resolution, before diffing. Cannot be combined with captureCurrent.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changed
    • changedInput schema / properties / baselinePath / description
      Previous value: -"Path to the baseline PNG file. Required unless captureBaseline is true."New value: +"Path to the saved baseline PNG file. Required unless captureBaseline is true; do not pass both."
    • changedInput schema / properties / captureBaseline / description
      Previous value: -"Capture the baseline screenshot live at full resolution before diffing. Cannot be combined with captureCurrent."New value: +"Capture the baseline screenshot live from the device, at full resolution, before diffing. Cannot be combined with captureCurrent."
    • changedInput schema / properties / captureCurrent / description
      Previous value: -"Capture the current screenshot live at full resolution before diffing. Cannot be combined with captureBaseline."New value: +"Capture the current screenshot live from the device, at full resolution, before diffing. Cannot be combined with captureBaseline."
    • changedInput schema / properties / currentPath / description
      Previous value: -"Path to the current PNG file. Required unless captureCurrent is true."New value: +"Path to the saved current PNG file. Required unless captureCurrent is true; do not pass both."
    • changedInput schema / properties / outputDir / description
      Previous value: -"Directory where diff artifacts should be written. Optional — defaults to a temp directory; the diff images are returned in the result either way."New value: +"Directory where diff artifacts should be written (default: a temp directory)."
  2. Changed1 schema field changedv0.24.0
    • changedInput schema / properties / rotation / description
      Previous value: -"Orientation override for live baseline/current captures."New value: +"Orientation override for live baseline/current captures. Ignored on physical iPhones."
  3. First observedv0.15.0

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations present, the description carries the full behavioral burden and does so: identical-dimension requirement, scale 1.0 baseline advice, status-bar band excluded from both pixel and OCR comparison, physical-iPhone capture scope and rotation being ignored, plus explicit failure conditions (invalid sources, unreadable PNGs, unwritable outputDir, unreachable simulator/emulator backend).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with purpose and the recommended flow, then requirements, use conditions, return shape, and failure modes in a sensible order. Each sentence contributes; it is dense but not padded, though the failure-mode sentence and dimension guidance could be tightened slightly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, yet the description explains the return object ({ summary }, diffPath, contextDiffPath) and their meanings, plus coordinate normalization matching describe. Combined with capture constraints, dimension rules, and error cases, nothing an agent needs to invoke this correctly appears to be missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3; the description adds real meaning on top by recommending the baselinePath + captureCurrent pairing as the standard flow and noting rotation is ignored on physical iPhones. The baselinePath/currentPath versus capture* mutual exclusion is largely restated from the schema, which keeps this below a 5.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening sentence names a specific verb and resource: compare two PNG screenshots and return a compact visual-diff summary. It states the scope (pixel/visual diff) clearly enough to separate it from siblings like screenshot and describe, which capture or describe UI rather than diff images.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives an explicit use condition – stable before/after screenshots with a pixel-visible expected result – and enumerates concrete qualifying cases (layout, spacing, color, typography, clipping, overflow). It also names the common baselinePath + captureCurrent regression flow. It stops short of naming an alternative tool for non-pixel-visible verification, so it isn't a full when/when-not map.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.