Skip to main content
Glama
livoras

Better Playwright MCP

by livoras

captureSnapshot

Capture a full-page snapshot of a webpage, including scrolling, waiting, and automatic trimming, to reduce HTML token usage and enable efficient web interactions.

Instructions

捕获网页的完整快照,支持滚动、等待和自动修剪功能

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageDescriptionNo页面描述(默认'Auto snapshot page')
pageNameNo页面名称(默认'snapshot')
scrollDelayNo滚动间隔时间(毫秒,默认5000)
scrollsNo滚动次数(默认1)
trimNo是否修剪重复内容(默认true)
urlYes要捕获的网页URL
waitNo初始等待时间(毫秒,默认5000)

Implementation Reference

  • The main handler function for capturing a snapshot of the current browser tab. It races against modal state changes to safely capture URL, title, ARIA tree snapshot, console messages, downloads, and modal states.
    async captureSnapshot() {
        let tabSnapshot;
        const modalStates = await this._raceAgainstModalStates(async () => {
            const snapshot = await this.page._snapshotForAI();
            tabSnapshot = {
                url: this.page.url(),
                title: await this.page.title(),
                ariaSnapshot: snapshot,
                modalStates: [],
                consoleMessages: [],
                downloads: this._downloads,
            };
        });
        if (tabSnapshot) {
            // Assign console message late so that we did not lose any to modal state.
            tabSnapshot.consoleMessages = this._recentConsoleMessages;
            this._recentConsoleMessages = [];
        }
        return tabSnapshot ?? {
            url: this.page.url(),
            title: '',
            ariaSnapshot: '',
            modalStates,
            consoleMessages: [],
            downloads: [],
        };
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While it mentions 'scrolling, waiting and auto-trimming' which describes some behavior, it doesn't cover important aspects like: what format the snapshot returns (image? PDF? HTML?), whether this is a read-only operation, potential performance implications, or error conditions. For a tool with 7 parameters and no annotation coverage, this is insufficient behavioral transparency.

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

Conciseness5/5

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

The description is extremely concise - a single Chinese sentence that efficiently communicates the core functionality. Every word earns its place: 'capture webpage complete snapshot' establishes purpose, 'support scrolling, waiting and auto-trimming' highlights key features. No wasted words or redundant information.

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

Completeness2/5

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

Given the tool's complexity (7 parameters, no output schema, no annotations), the description is insufficiently complete. It doesn't explain what 'snapshot' means in terms of output format, doesn't mention whether this requires an active browser page (context from sibling tools suggests it might), and provides no guidance on error handling or performance considerations. For a tool that likely produces visual/structured output, the lack of output information is a significant gap.

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 description coverage is 100%, so all parameters are documented in the schema. The description adds minimal value beyond the schema - it mentions 'scrolling, waiting and auto-trimming' which maps to scrolls, wait, and trim parameters, but doesn't provide additional context about how these interact or best practices. The baseline of 3 is appropriate when the schema does the heavy lifting.

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 description clearly states the tool's purpose as 'capture webpage snapshot' with specific capabilities (scrolling, waiting, auto-trimming). It distinguishes itself from siblings like getPageSnapshot and getScreenshot by emphasizing 'complete snapshot' with scrolling functionality. However, it doesn't explicitly differentiate from getPDFSnapshot which might also capture full pages.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context through 'complete snapshot, support scrolling, waiting and auto-trimming' which suggests this is for capturing entire pages that require scrolling. However, it doesn't provide explicit guidance on when to use this versus alternatives like getPageSnapshot (which might be simpler) or getPDFSnapshot (which might produce different output formats). No explicit exclusions or prerequisites are mentioned.

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

Related 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/livoras/better-playwright-mcp'

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