Skip to main content
Glama

screenshot_diff

Compare two screenshots (baseline vs actual) or capture a screenshot to identify visual differences, returning diff path, pixel count, ratio, and pass/fail status.

Instructions

Compare two screenshots (baseline vs actual) or capture a current screenshot and return a diff summary and artifact path. Supports element-scoped capture via selector; does not emit long screenshot descriptions.

中文详情:

  • 用途:比较两张截图(baseline/actual)或捕获当前截图并返回差异摘要与产物路径,不输出长截图描述

  • 何时使用:手动指定 baseline/actual 路径做差异对比时;测试前后页面状态对比时;元素级截图差异分析时;调试 visual_compare 流程时

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

  • 参数:

    • baselinePath (string, 可选):基线截图路径

    • actualPath (string, 可选):实际截图路径,与 baselinePath 同时提供时直接对比

    • beforePath (string, 可选):baselinePath 的别名

    • afterPath (string, 可选):actualPath 的别名

    • selector (string, 可选):捕获时仅截取该元素区域

    • threshold (number, 可选):差异阈值,默认 0.01

    • name (string, 可选):产物名称,用于命名 diff 文件

  • 错误:baselinePath 与 actualPath 都缺失且浏览器未启动抛出 'No screenshots to compare';文件不存在抛出 'File not found'

  • 示例:{"baselinePath":"screenshots/login.png","actualPath":"screenshots/login-v2.png","threshold":0.005,"name":"login-diff"}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNo
selectorNo
afterPathNo
thresholdNo
actualPathNo
beforePathNo
baselinePathNo
Behavior4/5

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

With no annotations, the description carries full burden and discloses important behaviors: it does not emit long screenshot descriptions, lists error conditions like missing screenshots and file not found. It adds context beyond the schema, though side effects or resource usage are not mentioned.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description contains a bilingual section (English and Chinese) which adds redundancy and length. However, it is well-structured with clear sections for usage, output, parameters, errors, and an example. It earns its place by being comprehensive, but conciseness suffers.

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?

Given the complexity (7 optional parameters, no output schema, no annotations), the description is remarkably complete. It includes the return structure, error messages, parameter explanations, and an example, enabling an agent to select and invoke the tool correctly without additional context.

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

Parameters5/5

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

Schema coverage is 0%, so the description fully compensates by explaining each parameter's purpose: baselinePath/actualPath for direct comparison, beforePath/afterPath as aliases, selector for element capture, threshold with default 0.01, and name for diff file naming. This provides rich meaning beyond the schema property names.

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 compares two screenshots or captures a current screenshot, returning a diff summary. It distinguishes itself from sibling tools like browser_screenshot and browser_visual_compare by focusing on diff comparison and not emitting long descriptions.

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 explicit scenarios for use, such as comparing baseline vs actual, testing page states, element-level diff, and debugging visual_compare flow. It implies when not to use by stating it does not emit long descriptions, but lacks explicit alternatives among the many sibling tools.

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