Skip to main content
Glama

glass_diff

Read-only

Detect visual changes by comparing current pixels against a saved baseline; returns change stats and bounding box.

Instructions

Compare current pixels with a named baseline; returns change stats and bbox. A single comparison does not establish transition completion or quiescence. Use glass_wait_for_region to wait; include_image:true returns the changed crop only when pixels differ.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeNo`"perceptual"` (default) or `"exact"`.
nameYesSaved baseline name; unsaved names error.
ignoreNoWindow-relative excluded rects intersected with region. changed_pct uses remaining pixels; ignored_pixels reports the excluded count.
regionNoWindow-relative comparison area; omit for whole window. Returned bbox is region-relative.
max_widthNoMaximum returned image width; shrinks after crop, preserving native comparison pixels.
thresholdNoPerceptual sensitivity for `mode="perceptual"`, 0..1 (default 0.1; smaller = stricter).
toleranceNoPer-channel tolerance for `mode="exact"` (default 0).
max_heightNoMaximum returned image height; omit both limits for native output.
include_imageNoAlso return the current frame cropped to the changed region (default false). No image is returned when nothing changed.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed9 schema fields changedv1.8.0
    • changedInput schema / $defs / RegionArgs / properties / height / description
      Previous value: -"Height in pixels, extending down from `y`."New value: +"Height in pixels."
    • changedInput schema / $defs / RegionArgs / properties / width / description
      Previous value: -"Width in pixels, extending right from `x`."New value: +"Width in pixels."
    • changedInput schema / $defs / RegionArgs / properties / x / description
      Previous value: -"Left edge in pixels, window-relative — 0 is the window's left edge, not the screen's."New value: +"Left edge in window-relative pixels."
    • changedInput schema / $defs / RegionArgs / properties / y / description
      Previous value: -"Top edge in pixels, window-relative — 0 is the window's top edge, not the screen's."New value: +"Top edge in window-relative pixels."
    • changedInput schema / properties / ignore / description
      Previous value: -"Window-relative rectangles to exclude from the comparison. Use for\nperpetually animating content — a blinking text caret, a clock, a\nspinner — which otherwise keeps `changed_pct` permanently non-zero.\n`changed_pct` is measured over the pixels that remain; the excluded\ncount is reported as `ignored_pixels`. Combines with `region`: rects are\nalways window-relative and are intersected with it."New value: +"Window-relative excluded rects intersected with region. changed_pct uses remaining pixels; ignored_pixels reports the excluded count."
    • addedInput schema / properties / max_height
      Added value: +{
      +  "description": "Maximum returned image height; omit both limits for native output.",
      +  "format": "uint32",
      +  "maximum": 4294967295,
      +  "minimum": 1,
      +  "type": [
      +    "integer",
      +    "null"
      +  ]
      +}
    • addedInput schema / properties / max_width
      Added value: +{
      +  "description": "Maximum returned image width; shrinks after crop, preserving native comparison pixels.",
      +  "format": "uint32",
      +  "maximum": 4294967295,
      +  "minimum": 1,
      +  "type": [
      +    "integer",
      +    "null"
      +  ]
      +}
    • changedInput schema / properties / name / description
      Previous value: -"Name of a baseline saved by `glass_baseline_save`; an unsaved name errors\nrather than reporting no change."New value: +"Saved baseline name; unsaved names error."
    • changedInput schema / properties / region / description
      Previous value: -"Optional window-relative sub-rectangle to diff; omit to diff the whole\nwindow. Scopes the comparison (and the reported `bbox`, which becomes\nregion-relative) to just this area — the way to ask \"did *only* this part\nchange?\" Mirrors `glass_wait_for_region`'s `region`."New value: +"Window-relative comparison area; omit for whole window. Returned bbox is region-relative."
  2. Changed6 schema fields changedv1.2.0
    • addedInput schema / $defs / RegionArgs / properties / height / description
      Added value: +"Height in pixels, extending down from `y`."
    • addedInput schema / $defs / RegionArgs / properties / width / description
      Added value: +"Width in pixels, extending right from `x`."
    • addedInput schema / $defs / RegionArgs / properties / x / description
      Added value: +"Left edge in pixels, window-relative — 0 is the window's left edge, not the screen's."
    • addedInput schema / $defs / RegionArgs / properties / y / description
      Added value: +"Top edge in pixels, window-relative — 0 is the window's top edge, not the screen's."
    • addedInput schema / properties / name / description
      Added value: +"Name of a baseline saved by `glass_baseline_save`; an unsaved name errors\nrather than reporting no change."
    • removedInput schema / title
      Removed value: -"DiffArgs"
  3. Addedv1.1.0
  4. Removedv1.0.3
  5. Addedv1.0.2

TDQS

A4.4/5.0
Behavior4/5

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

Annotations declare readOnlyHint=true, and the description adds behavioral context beyond that: it notes that include_image:true returns the changed crop only when pixels differ, and that a single comparison is insufficient for quiescence. It doesn't detail return stats format, but the read-only nature is covered by annotations and the description adds meaningful caveats.

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?

Three sentences with no waste. The core function is front-loaded, the critical caveat about quiescence follows immediately, and the include_image behavior is stated precisely. Every sentence 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 read-only comparison tool with 100% schema coverage and no output schema, the description covers the essential behavioral caveats: single comparison is not quiescence, use wait_for_region for waiting, and image return behavior. It could mention what 'change stats' includes, but the schema and read-only annotation carry much of the burden.

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 schema already documents all 9 parameters. The description adds value by explaining the include_image behavior (crop only when pixels differ) and the mode semantics, but most parameter meaning is already in the schema. Baseline 3 is appropriate.

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 ('Compare current pixels with a named baseline') and resource ('named baseline'), and distinguishes itself from siblings by naming glass_wait_for_region as the tool to use for waiting. It clearly identifies the tool's core function: returning change stats and bbox.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly says a single comparison does not establish transition completion or quiescence, and directs the agent to use glass_wait_for_region to wait. This provides clear when-to-use and when-not-to-use guidance, differentiating it from the waiting tool.

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