Skip to main content
Glama

Compare to reference

compare_to_reference

Compare a frame with a reference image of the screen being reproduced (a screenshot or mockup): returns the pixel difference (also ignoring 1px offsets and antialiasing), a 6×4 grid of where it differs, the elements that differ most (data-id) with the move that aligns them ("move 2px down") and the reference's color next to the rendered one, the layout issues of the same render, and a heatmap (render faded, differences in red) or a side-by-side view. The reference is a workspace image (/api/assets/… URL), an https URL or base64. The frame remembers it: later comparisons need only frameId. The frame is rendered at the reference's pixel density (e.g. 3 for a 1179px-wide iPhone screenshot of a 393px frame) unless scale is given. ignore leaves photos, maps or any element or box out of the scores (grey on the heatmap).

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": {
      "fileId": "<fileId>",
      "frameId": "<frameId>"
    },
    "name": "compare_to_reference"
  }
}

Input Schema

NameRequiredDescriptionDefault
viewNoImage returned with the metrics. side_by_side: reference left, render right.heatmap
scaleNoThe reference's pixel density, decimals allowed (2.625 = Pixel).
fileIdYes
ignoreNoAreas left out of every measure (shown grey on the heatmap): content that cannot match the reference, such as stock photos or a map from another provider, so the scores and the element list reflect the interface.
layoutNoAlso list the layout issues of the same render.
nodeIdNoCompare only this element's area (id#2: its 2nd copy in a template's rows; instanceId>nodeId: an element of a component drawn by an instance).
regionNoOnly this box of the frame, in frame CSS px: {y, height} (x and width default to the whole width). For long pages: inspect them in slices, e.g. {y: 0, height: 1200}, then {y: 1200, height: 1200}…
frameIdYes
referenceNo/api/assets/<id> (get_upload_url), https URL, or base64 PNG/JPEG/WebP. Omit to reuse the frame's reference.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Annotations declare readOnlyHint=false, and the description explains the state change that justifies it: the frame remembers the reference, so subsequent calls need only frameId. It also discloses non-obvious behavior beyond annotations — comparison ignores 1px offsets and antialiasing, the frame is re-rendered at the reference's pixel density unless scale is given, and ignored areas appear grey on the heatmap. Missing: nothing about latency, remote URL fetching (relevant to openWorldHint), or failure modes.

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 outputs, and every sentence carries information — reference sources, persistence, scale, ignore. The first sentence is very long and packs six output types into one clause chain, which could be split for scanability, but nothing is redundant.

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?

With 9 parameters, nested objects and no output schema, the description correctly carries the return-value burden by enumerating the metrics, element list, heatmap and side-by-side output. Complexity is well covered; the unexplained fileId and the absence of any note on cost/latency for a render-and-diff operation are the remaining gaps.

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?

Schema coverage is 78%, and the description adds real meaning beyond it: it explains scale in terms of pixel density with a concrete example (3 for a 1179px iPhone screenshot of a 393px frame), explains that ignore removes areas from scores and greys them on the heatmap, and explains the reference formats and the omit-to-reuse behavior. Only fileId remains unexplained in both description and schema.

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 and resource ("Compare a frame with a reference image of the screen being reproduced") and immediately enumerates what the comparison yields: pixel difference, 6×4 difference grid, most-differing elements with alignment moves, layout issues, heatmap or side-by-side. This is clearly distinguishable from get_screenshot and check_layout by its reference-image anchoring.

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?

Gives concrete operational context: the reference can be a workspace asset, https URL or base64; it is remembered by the frame so later comparisons need only frameId; and ignore is for content that cannot match (photos, maps). It does not explicitly route the agent away from check_layout when only layout issues are wanted, nor state prerequisites or cost of a comparison.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.