Skip to main content
Glama

compare_revisions

Idempotent

Compare two image revisions side-by-side, stacked, or as a pixel-difference heatmap to identify visual changes.

Instructions

Scale two revisions to a long edge of 640px each and compose them on one canvas (side by side, or stacked) with an 8px gap, returned inline as a JPEG. A is placed left/top, B is placed right/bottom. Useful for before/after or A/B visual checks. layout="diff" instead requires A and B to share the exact same dimensions and returns a single pixel-difference heatmap plus mean_abs_diff/max_abs_diff/changed_pixel_ratio.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
layoutNo`"side_by_side"`(既定、水平に並べる)| `"stacked"`(垂直に並べる)| `"diff"`(並べる代わりに1枚の差分ヒートマップを作る。A/B の寸法が完全一致している必要がある)。side_by_side
revision_id_aYes比較対象 A の revision ID("rev_...")。合成画像の左(または上)に置かれる。
revision_id_bYes比較対象 B の revision ID("rev_...")。合成画像の右(または下)に置かれる。

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYes
bYes
widthYes合成画像(比較プレビュー)の寸法・容量。
heightYes
layoutYes
byte_sizeYes
mime_typeYes
a_positionYesA が合成画像のどこに置かれるか("left" | "top")。
b_positionYesB が合成画像のどこに置かれるか("right" | "bottom")。
max_abs_diffNo`layout: "diff"` のときだけ載る: 画素ごとのチャンネル最大絶対差 d の、全画素中の最大値。
preview_pathYes比較プレビュー画像の絶対パス。
mean_abs_diffNo`layout: "diff"` のときだけ載る: 全チャンネル・全画素平均の絶対差(0..255 スケール)。
changed_pixel_ratioNo`layout: "diff"` のときだけ載る: d > 2 の画素が全体に占める割合(0.0..=1.0)。

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.5.2

TDQS

A4.1/5.0
Behavior4/5

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

The description discloses key behaviors: scaling to a 640px long edge, an 8px gap, placement of A and B, and the diff mode's requirement for identical dimensions plus its output metrics. Annotations provide idempotentHint=true and destructiveHint=false, and the description does not contradict them. It adds context about the output format (JPEG) and diff-specific metrics, which is valuable beyond the annotations.

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?

The description is compact and front-loaded with the primary behavior, then pivots to the diff variant. Each sentence serves a purpose—no filler. It could be slightly more concise, but it remains efficient and well-structured.

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?

Given the tool's moderate complexity (3 params, output schema present, annotations provided), the description covers the essential aspects: main usage, diff mode requirements, output format, and key behavioral details. It doesn't discuss error conditions or performance limits, but these are not critical for an agent to invoke the tool correctly. The presence of an output schema means the description need not elaborate on return values, and it still explains diff metrics.

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 coverage is 100%, so the schema already documents each parameter thoroughly (layout enum, revision IDs, placement). The description adds the scaling and gap behavior, but these are tool-wide behaviors rather than parameter-specific semantics. It does reinforce the diff layout's dimension requirement, which is already in the schema. The description adds marginal value, so a 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 clearly states the tool's function: it scales two revisions, composes them on a canvas (side by side or stacked), and returns a JPEG. It also explicitly differentiates the diff mode, which produces a pixel-difference heatmap. This is specific and distinct from sibling tools like apply_transform or detect_document, which focus on transformation or analysis rather than visual comparison.

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 description provides a clear use case: 'Useful for before/after or A/B visual checks.' It also explains when the diff layout is appropriate (when A and B share exact dimensions). However, it doesn't explicitly mention when not to use this tool or name alternatives, though among the siblings none serve the same comparison purpose, so the guidance is adequate.

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