browser_snapshot
Capture structured accessibility snapshots of web pages using Playwright MCP, enabling analysis without reliance on screenshots or visually-tuned models. Streamline web interaction and accessibility evaluation.
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:33-41 (handler)Handler function for browser_snapshot tool that ensures an active tab and triggers an accessibility snapshot capture.handle: async context => { await context.ensureTab(); return { code: [`// <internal code to capture accessibility snapshot>`], captureSnapshot: true, waitForNetwork: false, }; },
- src/tools/snapshot.ts:25-32 (schema)Schema definition for the browser_snapshot tool, including name, title, description, empty input schema (no parameters), and readOnly type.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', },
- src/tools.ts:35-50 (registration)Registration of the browser_snapshot tool (via snapshot module) into the snapshotTools array used for tool provision.export const snapshotTools: Tool<any>[] = [ ...common(true), ...console, ...dialogs(true), ...files(true), ...install, ...keyboard(true), ...navigate(true), ...network, ...pdf, ...screenshot, ...snapshot, ...tabs(true), ...testing, ...wait(true), ];
- src/tools/snapshot.ts:23-42 (registration)Definition and local registration of the browser_snapshot tool using defineTool.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 => { await context.ensureTab(); return { code: [`// <internal code to capture accessibility snapshot>`], captureSnapshot: true, waitForNetwork: false, }; }, });