browser_snapshot
Capture detailed accessibility snapshots of web pages to support WCAG compliance checks, offering insights beyond standard screenshots for improved remediation.
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:92-106 (handler)Core implementation of the browser_snapshot tool. The handler function ensures the current tab exists and sets the response to include a snapshot of the page DOM, enabling actions on elements.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/tools/snapshot.ts:94-100 (schema)Schema definition for the browser_snapshot tool, specifying empty input schema as it takes no parameters.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:38-56 (registration)The browser_snapshot tool from snapshot.ts is included in the central allTools registry via spread operator.export const allTools: Tool<any>[] = [ ...common, ...console, ...dialogs, ...evaluate, ...files, ...form, ...install, ...keyboard, ...navigate, ...network, ...mouse, ...pdf, ...screenshot, ...snapshot, ...tabs, ...wait, ...verify, ];
- src/tools/snapshot.ts:229-235 (registration)The snapshot tool (browser_snapshot) is exported as part of the module's default tools array.export default [ snapshot, click, drag, hover, selectOption, scanPage
- src/tools/utils.ts:79-80 (helper)Helper error message recommending use of browser_snapshot when element refs are invalid.throw new Error('Ref not found, likely because element was removed. Use browser_snapshot to see what elements are currently on the page.'); }