Compare to reference
compare_to_referenceCompare 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
| Name | Required | Description | Default |
|---|---|---|---|
| view | No | Image returned with the metrics. side_by_side: reference left, render right. | heatmap |
| scale | No | The reference's pixel density, decimals allowed (2.625 = Pixel). | |
| fileId | Yes | ||
| ignore | No | Areas 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. | |
| layout | No | Also list the layout issues of the same render. | |
| nodeId | No | Compare 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). | |
| region | No | Only 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}… | |
| frameId | Yes | ||
| reference | No | /api/assets/<id> (get_upload_url), https URL, or base64 PNG/JPEG/WebP. Omit to reuse the frame's reference. |