Skip to main content
Glama

browser_snapshot

Capture structured accessibility snapshots of web pages using Playwright MCP, enabling LLMs to interact without screenshots or visual models.

Instructions

Capture accessibility snapshot of the current page, this is better than screenshot

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Primary handler implementation for the 'browser_snapshot' tool. It defines the tool schema and the execute function which ensures a tab context and sets the response to include the page snapshot.
    const snapshot = defineTool({ capability: 'core', schema: { name: 'browser_snapshot', title: 'Page snapshot', description: 'Capture accessibility snapshot of the current page, this is better than screenshot', inputSchema: z.object({}), type: 'readOnly', }, handle: async (context, params, response) => { await context.ensureTab(); response.setIncludeSnapshot(); }, });
  • Secondary handler for 'browser_snapshot' in LoopTools context, which runs a task to capture the browser snapshot.
    export const snapshot = defineTool({ schema: { name: 'browser_snapshot', title: 'Take a snapshot of the browser', description: 'Take a snapshot of the browser to read what is on the page.', inputSchema: z.object({}), type: 'readOnly', }, handle: async (context, params) => { return await context.runTask('Capture browser snapshot', true); }, });
  • src/tools.ts:36-52 (registration)
    Registers the browser_snapshot tool by spreading exports from snapshot.ts (which includes browser_snapshot) into the allTools array used by the MCP server.
    export const allTools: Tool<any>[] = [ ...common, ...console, ...dialogs, ...evaluate, ...files, ...install, ...keyboard, ...navigate, ...network, ...mouse, ...pdf, ...screenshot, ...snapshot, ...tabs, ...wait, ];
  • Registers the LoopTools browser_snapshot tool in the server backend's tools list.
    private _tools: Tool<any>[] = [perform, snapshot];
  • Helper error message referencing browser_snapshot for debugging element refs.
    throw new Error('Ref not found, likely because element was removed. Use browser_snapshot to see what elements are currently on the page.'); } }

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/maywzh/playwright-mcp'

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