browser_snapshot
Capture structured accessibility snapshots of web pages to enable browser automation without screenshots, providing detailed insights for interaction and analysis via Playwright MCP.
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)The handler function for the 'browser_snapshot' tool. It ensures an active tab and returns a result instructing the system to capture an accessibility snapshot of the page without waiting for network events.handle: async context => { await context.ensureTab(); return { code: [`// <internal code to capture accessibility snapshot>`], captureSnapshot: true, waitForNetwork: false, }; },
- src/tools/snapshot.ts:25-31 (schema)Schema definition for the 'browser_snapshot' tool using Zod, specifying 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/snapshot.ts:23-42 (registration)Local registration of the 'browser_snapshot' tool using the defineTool factory, including capability, schema, and handler.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, }; }, });
- src/tools.ts:36-52 (registration)Top-level registration where the snapshot tools module (including 'browser_snapshot') is spread into the main 'snapshotTools' array for export.export const snapshotTools: Tool<any>[] = [ ...common(true), ...console, ...dialogs(true), ...files(true), ...install, ...keyboard(true), ...navigate(true), ...network, ...pdf, ...screenshot, ...snapshot, ...tabs(true), ...testing, ...video, ...wait(true), ];
- src/tools/snapshot.ts:219-226 (registration)Export of the 'snapshot' tool (browser_snapshot) along with related interaction tools from the snapshot module.export default [ snapshot, click, drag, hover, type, selectOption, ];