Skip to main content
Glama

reference

Read a target image the page should match at full resolution; crop, grid, sample colors, and compare it with the open page to measure pixel differences.

Instructions

Reads a reference picture the page should match (a photo, artwork, mockup or screenshot in the project, e.g. refs/01.jpg) at full resolution, in one call and with no page open: crop [left, top, right, bottom] in the picture's pixels, enlarged up to 4× to fit 1280 px, with grid lines every N px labelled in the picture's own pixel coordinates (positions read off it go straight into the next call or the scene), and sample points, each answered as #rrggbb. With the page open, compare: true puts the picture, the page's look (from camera when given) and a difference picture side by side and says what share of pixels differ, overall and in a grid of regions (cells per side, 4 by default), with each sample point's colour on both, or that the canvas aspect is not the picture's. Use it to read a picture the page should match and to check the page against it.

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": {
      "cwd": "<cwd>",
      "file": "<file>"
    },
    "name": "reference"
  }
}

Input Schema

NameRequiredDescriptionDefault
cwdYesThe game project's folder.
cropNo[left, top, right, bottom] in the picture's pixels ([x, y, width, height] is read as such when right < left or bottom < top), trimmed to the picture; the whole picture when left out. With compare: that region of the picture and the same region of the page, enlarged side by side with their differences.
fileYesThe picture's path, relative to cwd, or the name of a baseline saved with look { save } (compare the page with its earlier look).
gameNoThe name the game was opened under with the `open` tool, to act on ("main" by default; a subagent uses its own).
gridNoGridline spacing in the picture's pixels (100 on a whole picture, 10 to 50 on a crop); none when left out.
cellsNoRegions per side for compare's differing-share grid (4 by default).
cameraNoFor compare: the page's look from this position (looking at lookAt) or from a camera by name, as `look`'s camera; left out, the picture's entry in refs/cameras.json when there is one, else the page's own camera.
sampleNoPoints [x, y] in the picture's pixels whose colour to return (the mean of 5 × 5 pixels); with compare, the page's colour at the same point too.
compareNoPut the open page's look beside the picture with their differences; needs `open` first, and a canvas with the picture's aspect for the pixel comparison.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.1

TDQS

A4.2/5.0
Behavior5/5

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

Annotations only say readOnlyHint=false and openWorldHint=true; the description carries far more: full-resolution single-call reading with no page open, crop enlargement capped at 4x to 1280 px, gridline labelling in the picture's own pixel coordinates, sample colours averaged over 5x5 pixels returned as #rrggbb, and compare's pixel-difference share with per-region cells plus the aspect-mismatch failure case. It also discloses a hidden default (camera falls back to refs/cameras.json), which is exactly the kind of context annotations cannot convey. Nothing here contradicts readOnlyHint=false, since compare generates a difference picture.

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?

Purpose is front-loaded in the opening clause, but the body is a single sprawling run-on sentence with nested parentheticals covering crop, grid, sample and compare in one breath. Every fact is relevant, yet the density and lack of sentence breaks make it harder to scan than it needs to be.

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 nine-parameter tool with no output schema, the description covers the important behaviours: both modes, coordinate conventions, sampling output format and the aspect precondition for comparison. Remaining gaps are minor — the return medium (an image plus textual annotations) and error behaviour for a missing file are implied rather than stated.

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%, so the baseline is 3. The description restates much of that schema content (crop bounds, grid, sample, cells default of 4) rather than adding new semantics; the marginal additions — suggested grid spacing of 100 on a whole picture versus 10–50 on a crop, and that coordinates read off a grid feed directly into the next call — are useful but limited.

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 ('Reads a reference picture the page should match') and immediately distinguishes the two operating modes: standalone reading with no page open, versus the compare mode that requires `open` first. It also names sibling `look` for camera/baseline provenance, so an agent can place it relative to the surrounding toolset.

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 closing sentence gives the two use cases directly ('read a picture the page should match' and 'check the page against it'), and the compare clause states the precondition ('needs `open` first'). What is missing is an explicit exclusion — e.g. when to reach for `look` or `observe` instead of this tool — so selection against siblings is only partly guided.

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