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: [], }; }

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