browser_snapshot
Capture structured accessibility snapshots of web pages for automated testing and content analysis, providing detailed page information without screenshots.
Instructions
Capture accessibility snapshot of the current page, this is better than screenshot
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filename | No | Save snapshot to markdown file instead of returning it in the response. |
Implementation Reference
- src/tools/snapshot.ts:33-41 (handler)Handler function for the browser_snapshot tool. Ensures a tab is active and instructs to capture an accessibility snapshot of the page.handle: async context => { await context.ensureTab(); return { code: [`// <internal code to capture accessibility snapshot>`], captureSnapshot: true, waitForNetwork: false, }; },
- src/tools/snapshot.ts:25-30 (schema)Schema definition for the browser_snapshot tool, including name, description, empty input schema, 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)Tool registration using defineTool, defining the browser_snapshot tool with its 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:35-50 (registration)Main registration of tools including those from snapshot.ts (browser_snapshot) into the snapshotTools array.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:219-226 (registration)Module export including the snapshot tool for import into main tools list.export default [ snapshot, click, drag, hover, type, selectOption, ];