Skip to main content
Glama

browser_screenshot_element

Capture a screenshot of a page element using its CSS selector, returning the file path and dimensions. Optionally add padding to expand the capture area.

Instructions

Screenshot a specific page element located by CSS selector, returning the artifact path and dimensions. Supports padding to expand the captured area.

中文详情:

  • 用途:对指定 CSS 选择器元素截图,截取该元素的可见区域,返回截图路径和尺寸信息

  • 何时使用:组件级截图取证时;视觉对比前截取元素图时;bug 报告附带局部截图时;多元素单独留档时

  • 输出:{ ok: boolean, path: string, name: string, selector: string, width: number, height: number, timestamp: string }

  • 参数:

    • selector (string, 必填):目标元素的 CSS 选择器

    • padding (number, 可选):截图区域周围的 padding,单位像素,默认 0

    • name (string, 可选):截图文件名(不含扩展名),默认自动生成

  • 错误:selector 无匹配抛出 'element not found';元素不可见抛出 'element not visible'

  • 示例:{"selector":".user-avatar","padding":10,"name":"avatar-component"}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNo截图文件名(不含扩展名),默认自动生成
paddingNo截图区域周围的padding,单位像素,默认0
selectorYes目标元素的CSS选择器
Behavior4/5

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

With no annotations, the description carries the full burden and covers key behaviors: returns path and dimensions, supports padding, and lists specific errors (element not found, not visible). It could mention scrolling into view, but overall transparent.

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 an English summary and detailed Chinese sections, clearly separating purpose, usage, output, parameters, errors, and example. Bilingual content increases length but each section adds value.

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?

The description covers all essential aspects: purpose, when to use, output format (including fields), error conditions, parameters with defaults, and an example. Without an output schema, the explicit output format makes it complete.

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?

Input schema has 100% coverage, so baseline is 3. The description adds an example JSON and clarifies defaults for 'name' and 'padding', providing modest additional value beyond the schema.

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 takes a screenshot of a specific page element via CSS selector, returning the artifact path and dimensions. This distinguishes it from sibling tools like `browser_screenshot` (full page) and `browser_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 includes a dedicated 'when to use' section listing four scenarios (component-level screenshots, before visual comparison, bug reports, multi-element documentation), providing clear context. However, it does not explicitly exclude alternatives or mention when not to use.

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