Skip to main content
Glama

视觉基线对比

browser_visual_diff
Destructive

Detect UI regressions by saving a page screenshot as a named baseline and comparing later captures with pixel-level diffs and configurable failure thresholds.

Instructions

Visual regression loop for UI review. action=save stores the current page screenshot as a named baseline (under ~/.aabrowser/baselines/, override with AA_BROWSER_BASELINE_DIR); action=compare captures again and returns a pixel-level diff (changed pixels, percent, bounding box, mean/max channel difference) plus a red diff image path. compare returns isError when the change exceeds maxDiffPercent, so it can be used as a visual assertion. action=list shows baselines; action=delete removes one. Use fullPage:true for long pages.

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": {
      "action": "<action>"
    },
    "name": "browser_visual_diff"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameNoBaseline name: letters/digits/dot/underscore/hyphen, max 80 chars
tabIdNoTab id (default: active tab)
actionYesBaseline operation
fullPageNoCapture the whole document instead of the viewport (default false)
writeDiffNoWrite a red-highlighted diff PNG (default true)
maxDiffPercentNoFail the comparison when changed pixels exceed this percent (default 0.5)
pixelThresholdNoPer-channel difference that counts as a changed pixel (0–255, default 16)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.15.0

TDQS

A4.1/5.0
Behavior5/5

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

Annotations already declare destructiveHint=true and readOnlyHint=false, but the description adds substantive behavior on top: baseline storage location (~/.aabrowser/baselines/), the AA_BROWSER_BASELINE_DIR override, the exact return payload of compare (changed pixels, percent, bounding box, mean/max channel difference, red diff image path), and the isError semantics that drive assertion use. That is precisely the extra context annotations cannot carry.

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 purpose is front-loaded in the first sentence and is followed by a per-action walkthrough, so an agent can scan to the mode it needs. It is densely packed with semicolons and parentheticals, and the storage-path detail in the middle of the save clause slightly interrupts the action-by-action flow.

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?

With no output schema, the description does an adequate job of describing what compare returns and that list shows baselines, and it explains the error path that makes compare usable as an assertion. It leaves the return shape of save and delete unstated and does not say whether saving over an existing baseline replaces it, which matters given destructiveHint=true.

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% and every parameter already has a description including defaults and ranges, so the baseline is 3. The description adds real meaning for maxDiffPercent (it governs the isError condition, not just a numeric knob) and for fullPage (use it on long pages), but says nothing extra about name, tabId, writeDiff, or pixelThreshold beyond what the schema states.

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?

The opening sentence names a specific capability, 'Visual regression loop for UI review', and the body enumerates all four action modes (save/compare/list/delete) with the concrete resource being managed (named screenshot baselines). This is far more specific than the bare title '视觉基线对比'. It stops short of naming a sibling such as browser_assert, only gesturing at the overlap with 'can be used as a visual assertion', so it does not reach full sibling differentiation.

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?

Each action gets a stated purpose, and there is direct usage advice: 'Use fullPage:true for long pages' plus the note that compare is suitable as a visual assertion because it returns isError above the threshold. What is missing is any exclusion or explicit routing rule, e.g. when to prefer browser_assert or browser_evidence over capturing a baseline diff.

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