Skip to main content
Glama

Semantic visual diff (element-resolved regression)

visual_diff_regions

Diff a page against a saved baseline, cluster changed pixels into regions, and identify the exact DOM element responsible—turning vague pixel percentages into actionable element-level change reports.

Instructions

Visual regression that points at code, not pixels: diffs the current render against a saved baseline, clusters the changed pixels into regions, and hit-tests each against the live DOM — so you get "button.cta-primary — 1,240 changed px" instead of "3.2% of pixels changed". A delta overlay is saved to disk. Requires a baseline from compare_to_baseline with matching fullPage.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tagYesBaseline to diff against — the name used with set_baseline.
urlYesAbsolute URL to open, e.g. http://localhost:5173.
reloadNoReload even if the URL is already open (default reuses it, so it can be stale after an edit).
fullPageNoCapture the whole scrollable page instead of the visible fold. Clipped at 7900px, and the truncation is reported.
viewportNoSwitch to this breakpoint first. Default: keep the current one.
maxVariancePctNoCI gate for diff_against_baseline: FAIL when variance exceeds this percentage (0.5 = 0.5% pixel drift). Omit to report without a verdict.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.29.0

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations, the description carries full behavioral burden. It discloses that it saves a delta overlay to disk, requires a matching fullPage baseline, and can act as a CI gate via maxVariancePct. It does not cover failure modes or error handling, but it covers the main side effects and constraints adequately.

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?

Two sentences with no wasted words. The first sentence front-loads the core purpose and mechanism, while the second adds a critical prerequisite and parameter nuance. Every word earns its place.

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

Completeness4/5

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

For a complex tool with 6 parameters, the description covers the essential usage context: baseline requirement, fullPage matching, CI gate behavior, and the delta overlay side effect. It does not mention output format or failure scenarios, but given the absence of an output schema and the tool's apparent role in a regression workflow, the coverage is strong.

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 for this dimension is 3. The description adds value by explaining the purpose of maxVariancePct as a CI gate, noting that fullPage clipping is reported, and clarifying reload's default behavior. These extra details go beyond the schema descriptions.

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 description states a specific verb (diffs), a precise resource (current render against a saved baseline), and the unique value proposition (element-resolved regression vs. pixel-level). It clearly distinguishes itself from siblings like compare_to_baseline by highlighting the element-resolution mechanism and output format.

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?

The description explicitly requires a baseline from compare_to_baseline with matching fullPage, giving a clear prerequisite and pointing to a sibling tool. It implies when to use this tool (when element-level diff is needed) but does not explicitly state when not to use it or list alternative tools beyond the prerequisite.

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