Skip to main content
Glama

Pixel-diff two .riv files

riv_visual_diff

Compare two .riv files by rendering the same artboard, animation, and time under identical conditions, then compute a thresholded pixel diff and return match rate, differing pixel count, and diff PNG.

Instructions

Render the same artboard/animation/time from two .riv files under identical conditions (forced to the same output size) and compute a thresholded per-pixel visual diff. Returns match rate, differing pixel count, and a diff visualization PNG (differing pixels in red, matching pixels dimmed).

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": {
      "pathA": "<pathA>",
      "pathB": "<pathB>"
    },
    "name": "riv_visual_diff"
  }
}

Input Schema

NameRequiredDescriptionDefault
outNoOutput diff PNG path (default: alongside pathA)
timeNoSeconds to advance before capturing (default 0)
pathAYesPath to the first .riv file
pathBYesPath to the second .riv file
widthNoOutput width in px (default: artboard width)
heightNoOutput height in px (default: keeps the artboard aspect ratio)
artboardNoArtboard name (default: first artboard)
animationNoAnimation name; ignored when stateMachine is set (default: the first state machine, else the first animation)
thresholdNoMax per-channel diff (0-255) still counted as a match (default 16)
backgroundNoCSS background color (default: transparent)
stateMachineNoState machine name (takes precedence over animation)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv0.8.0
    • addedInput schema / properties / animation / description
      Added value: +"Animation name; ignored when stateMachine is set (default: the first state machine, else the first animation)"
    • addedInput schema / properties / artboard / description
      Added value: +"Artboard name (default: first artboard)"
    • addedInput schema / properties / background / description
      Added value: +"CSS background color (default: transparent)"
    • addedInput schema / properties / height / description
      Added value: +"Output height in px (default: keeps the artboard aspect ratio)"
    • addedInput schema / properties / stateMachine / description
      Added value: +"State machine name (takes precedence over animation)"
    • addedInput schema / properties / width / description
      Added value: +"Output width in px (default: artboard width)"
  2. First observedv0.5.0

TDQS

A3.7/5.0
Behavior3/5

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

With no annotations at all, the description carries the full behavioral burden, and it does disclose useful traits: both inputs are forced to the same output size, the diff is thresholded, and the PNG color-codes differing (red) vs matching (dimmed) pixels. It says nothing about cost/runtime, what happens when the artboard or animation is missing in one file, or whether comparison failures error or return a partial result.

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?

Two sentences, zero filler, with the operation and its conditions stated before the return values. Nothing is repeated from the schema and nothing is padding.

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?

Eleven parameters, no output schema, no annotations - the description compensates by spelling out the render conditions and the exact return payload (match rate, differing pixel count, diff PNG). The remaining gap is failure/edge behavior (mismatched artboards, unresolvable names) for a comparison tool whose whole value depends on the two inputs being comparable.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description adds real meaning: 'same artboard/animation/time' ties artboard, animation and time into one comparison contract, and 'forced to the same output size' explains that width/height govern both renders, not just one. That is a modest but genuine lift over the per-field schema text.

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?

States a concrete verb and resource: render two .riv files under identical conditions and compute a thresholded per-pixel diff, plus what it returns. The pixel-level framing implicitly separates it from riv_diff and riv_ab_compare, but no sibling is named, so an agent must infer the boundary.

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

Usage Guidelines3/5

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

Usage is only implied by the mechanics described ("render the same artboard/animation/time from two .riv files"); there is no explicit when-to-use, when-not-to-use, or statement of how this differs from riv_diff / riv_ab_compare. Given those siblings exist, an agent gets no routing guidance.

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