Skip to main content
Glama

Pixel-diff an implementation against a contract screenshot

diff_pixels
Read-only

Compare rendered implementation against a reference screenshot pixel by pixel to detect subtle visual differences. Use after structural checks; returns diff percentage and image path.

Instructions

Renders the implementation URL and compares it pixel by pixel against the reference screenshot stored in the contract. Use this for a stricter visual check than check_implementation, after the structural check passes or when a subtle rendering difference is suspected. Requires the contract to have been extracted with screenshotDir set. Returns the percentage of differing pixels, the threshold it was compared against, ok, and the filesystem path of the generated diff image.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe implementation URL to capture and compare pixel by pixel.
waitNoExtra settle time in milliseconds after navigation. Defaults to 2000.
masksNoCSS selectors to blank out before comparing, for example ads or timestamps.
outDirNoDirectory to write the diff image to. Defaults to the OS temp directory.
timeoutNoNavigation timeout in milliseconds. Defaults to 30000.
headlessNoRun the browser headless. Defaults to true.
selectorNoCSS selector to scope the comparison to. Defaults to the contract root.
viewportNoViewport name to compare. Defaults to the first viewport in the contract.
thresholdNoAllowed percent of differing pixels before the comparison fails. Defaults to 0.5.
contractPathYesPath to a contract JSON file previously written by extract_contract.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnly and openWorld, so the safety profile is covered. The description adds real value beyond that: the screenshotDir precondition and the concrete return payload (percent differing pixels, threshold, ok, diff image path). It does not mention that a diff image file is written to disk as a side effect, which is a small gap.

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

Conciseness5/5

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

Four sentences, front-loaded with the core action, then routing guidance, then the precondition, then the return contract. No filler and nothing redundant with structured fields.

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?

For a 10-param tool with no output schema, the description covers the essential gap: it enumerates the return values so the agent knows what a result contains, plus the precondition for the call to succeed. Nothing critical is missing.

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

Parameters3/5

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

Schema description coverage is 100% and each of the 10 parameters carries its own description with defaults, so the schema does the heavy lifting. The description adds no parameter-level syntax or format detail beyond it; baseline 3 is appropriate.

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?

States a specific verb (renders and compares pixel by pixel) and resource (implementation URL vs. contract reference screenshot). It explicitly positions itself against the sibling check_implementation as a 'stricter visual check', so an agent can select between them without opening either schema.

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

Usage Guidelines5/5

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

Gives explicit when-to-use conditions ('after the structural check passes or when a subtle rendering difference is suspected') and names the alternative tool. It also states the prerequisite that the contract must have been extracted with screenshotDir set.

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