Skip to main content
Glama

compare_image

Compares a PNG screenshot of a built screen against the Figma node render to detect visual mismatches, reporting differing regions for layout, text, and image review.

Instructions

Compare a PNG screenshot of the built screen with the node as figlens renders it, to check visual fidelity with a tool instead of by eye. The node is drawn over its layout box at the screenshot's scale (screenshot width / node width, or scale), composited over white; a pixel differs when no pixel within one CSS pixel in the other image is within the threshold (48/255 per channel by default), so anti-aliasing does not count, but differences under it (light borders, subtle tints) are not seen. Differing pixels are grouped into regions on an 8 px grid; regions under 12 px² are dropped. Returns sizes, scale, mismatch (differing pixels / compared pixels), nonTextMismatch and textMismatch, nonImageMismatch and imageMismatch, and the largest regions in node pixels from its top-left, each with the deepest layers under it (id, name, type) and text: true when nearly all of it lies over TEXT layers (often font fallback or line breaks, but also a wrong text color, size or copy: review each) and image: true when nearly all of it lies only over image-filled layers (content such as banners or avatars, often from data). ignore leaves listed layers' render boxes out of every count and region, for content that differs by data rather than layout (their own size and position are then unmeasured); the reply lists them. threshold lowers the 48 default to see light borders and dividers, at the cost of more anti-aliasing noise. A screenshot taller than the node is compared over the node's height and the rest reported as uncompared; a shorter one, or a width that does not match scale, is refused, unless fullPage states the shorter one is the whole page: then its rows are compared and the node rows it lacks (past 1 px rounding) are reported as uncompared.missing and counted as one differing region over the layers there. warnings name what figlens skipped or approximated in the node, where a difference may be figlens's. out writes a diff PNG: the screenshot washed out, differing pixels red, ignored pixels gray, regions outlined red (layout), blue (text) or purple (image). Capture the screenshot at the node's size with fonts loaded; a viewport capture of a taller page needs a full-page screenshot.

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": {
      "file": "<file>",
      "node": "<node>",
      "image": "<image>"
    },
    "name": "compare_image"
  }
}

Input Schema

NameRequiredDescriptionDefault
outNodiff PNG path ending in .png, in .figlens/exports/ under the project root unless the user names one; create the parent directory first; never the screenshot or the design
fileYesthe saved .fig: a local path (absolute recommended), or gs://bucket/object using gcloud; remote sources are unavailable with --root
nodeYesa stored node id (12:345 or 12-345), full instance sublayer id (I12:345;67:89) from inspect/nodes, or a Figma URL with ?node-id=
imageYesPNG screenshot of the implemented screen, cropped to the node (a full-page capture may be taller); at most 64 MiB and 25,000,000 pixels
limitNomost regions listed, largest first, 1-50, default 10; counts cover all regions
scaleNoscreenshot pixels per node pixel, such as the device pixel ratio; default: the screenshot width / the node width
ignoreNocomma-separated ids of layers inside node, such as data-driven images or user text, whose render boxes are left out of mismatch, its splits and regions; the reply lists them under ignored
fullPageNothe image is a full-page capture of the whole page: one shorter than the node is compared over its height and the missing rows reported as a differing region, a height finding; leave false for a viewport capture, which is then refused
thresholdNoper-channel difference (of 255) above which pixels differ, 1-254, default 48; lower it (such as 16) to see a light border, divider or shadow the default misses

Output Schema

NameRequiredDescriptionDefault
nodeYesid, name and type of the compared node
pathNowith out: the diff PNG written
frameYesthe node's layout box width and height in node pixels
scaleYes
ignoredNowith ignore: nodes {id, name, type} and pixels, the screenshot pixels left out of every count
regionsYeslargest first, at most limit: x, y, width, height in node pixels from its top-left, pixels (differing screenshot pixels), text, image, and nodes: up to 3 deepest layers under it as {id, name, type}, most differing pixels first
comparedYeswidth and height of the compared area in screenshot pixels
mismatchYesdiffering pixels / compared pixels, 0-1; with uncompared.missing, both include the missing rows as differing; ignored pixels are in neither
warningsYesknown skipped or approximated rendering in the node, as export's
thresholdYesper-channel difference (of 255) above which pixels differ
screenshotYeswidth and height in pixels
uncomparedNobelow: screenshot rows past the node's height, not compared; missing: with fullPage, node rows past the screenshot's bottom, counted as differing
regionCountYes
textMismatchYesdiffering pixels in regions' cells over text layers / compared pixels
imageMismatchYesdiffering pixels in regions' cells only over image-filled layers / compared pixels
nonTextRegionsYesregions not marked text
nonTextMismatchYesdiffering pixels in regions' cells not over text layers / compared pixels
nonImageMismatchYesdiffering pixels in regions' cells not only over image-filled layers / compared pixels

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.11.3

TDQS

A4.4/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and discloses extensive behavior: compositing over white, pixel comparison rules, anti-aliasing handling, region grouping, dropped regions, ignore semantics, threshold effects, screenshot size handling, warnings, and diff PNG output. This is unusually thorough for a tool with no annotations.

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

Conciseness3/5

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

The purpose is front-loaded, but the description is a dense single paragraph with many long clauses. Most content is relevant, yet the lack of structure makes it harder to scan than necessary for a tool with nine parameters.

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?

The description covers the tool's complex behavior, edge cases, prerequisites, and output implications thoroughly. Even though an output schema exists, the added explanation of return fields and diff PNG contents makes the definition complete for an agent.

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

Parameters5/5

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

Although schema coverage is 100%, the description adds substantial meaning beyond the schema: it explains why ignore exists, the cost of lowering threshold, how fullPage changes comparison behavior, and what the out diff PNG contains. These details help an agent use the parameters correctly rather than merely restating their types.

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

Purpose4/5

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

The description states a specific verb and resource: compare a PNG screenshot of the built screen with the node as figlens renders it. It is clear what the tool does, but it does not explicitly distinguish itself from sibling tools such as diff or verify.

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 clear context for use, including capturing the screenshot at the node's size with fonts loaded and using fullPage for taller pages. It does not explicitly name when to use this tool versus alternatives like diff or verify.

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