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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/snapshot.ts:23-37 (handler)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(); }, });
- src/loopTools/snapshot.ts:20-32 (handler)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, ];
- src/loopTools/main.ts:41-42 (registration)Registers the LoopTools browser_snapshot tool in the server backend's tools list.private _tools: Tool<any>[] = [perform, snapshot];
- src/tools/utils.ts:79-81 (helper)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.'); } }