Skip to main content
Glama

browser_visual_compare

Capture a screenshot of the current page, compare it against a visual baseline, and receive diff metrics and artifact paths to identify UI changes.

Instructions

Capture an actual PNG of the current page, compare against the same-named visual baseline, generate a diff PNG, and return diffPixels, diffRatio, passed flag, and artifact paths.

中文详情:

  • 用途:截取当前页面 actual PNG 与同名视觉基线对比,生成 diff PNG 并返回差异指标和产物路径

  • 何时使用:UI 改动后回归对比时;多环境(dev/staging/prod)视觉一致性验证时;组件样式调整后差异检测时;CI 中视觉回归门禁时

  • 输出:{ ok: boolean, name: string, baselinePath: string, actualPath: string, diffPath: string, diffPixels: number, diffRatio: number, passed: boolean, threshold: number }

  • 参数:

    • name (string, 必填):要对比的基线名称,不含扩展名

    • selector (string, 可选):CSS 选择器;需与基线截图范围一致

    • fullPage (boolean, 可选):是否全页截图,默认 true;selector 存在时忽略

    • maskSelectors (array, 可选):截图前额外遮挡/脱敏的 CSS 选择器列表,用于忽略动态区域

    • maxDiffPixelRatio (number, 可选):允许的最大差异像素比例,默认 0.01

    • sessionName (string, 可选):浏览器会话名称,默认当前活跃会话

  • 错误:基线不存在抛出 'Baseline not found, run browser_visual_baseline first';selector 无匹配抛出 'element not found'

  • 示例:{"name":"login-page-baseline","maxDiffPixelRatio":0.005,"maskSelectors":[".timestamp"]}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes要对比的基线名称,不含扩展名
fullPageNo是否全页截图,默认 true;selector 存在时忽略
selectorNo可选 CSS 选择器;需与基线截图范围一致
sessionNameNo浏览器会话名称,默认当前活跃会话
maskSelectorsNo截图前额外遮挡/脱敏的 CSS 选择器列表,用于忽略动态区域
maxDiffPixelRatioNo允许的最大差异像素比例,默认 0.01
Behavior4/5

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

With no annotations provided, the description carries the full burden. It describes the entire process (capture, compare, generate diff, return artifacts) and documents two error cases (missing baseline, selector not found). It does not mention potential side effects or performance impacts, but the behavioral outline is thorough.

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 well-structured with English first then Chinese. The bilingual approach adds length but both parts are necessary for the target audience. Every sentence adds value, though the English and Chinese sections overlap somewhat.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite having no output schema, the description itemizes all return fields. It covers all 6 parameters, lists error conditions, and provides an example. This fully compensates for the missing output schema given the tool's complexity.

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 baseline is 3. The description adds extra semantics: name without extension, sessionName default, selector consistency requirement, and an example JSON. These additions justify a score above baseline.

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 it captures a PNG, compares against a baseline, generates a diff, and returns metrics. It uses specific verbs and resources, and the detailed explanation leaves no ambiguity about the tool's function.

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 Chinese section explicitly lists usage scenarios (UI regression, multi-environment consistency, style adjustment detection, CI gates). It does not specify when not to use or mention alternatives, but the given contexts are clear and actionable.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/validpilot/ai-verify-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server