browser_snapshot
Capture structured accessibility snapshots of web pages using browser automation, enabling detailed page analysis without relying on screenshots or visually-tuned 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)Core implementation of the browser_snapshot tool, including schema and handler. The handler ensures a tab is open and sets the response to include an accessibility snapshot of the page.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.ts:36-52 (registration)Registers the browser_snapshot tool (imported from snapshot.ts at line 27) by including it in the allTools array, which is used by the server backend.export const allTools: Tool<any>[] = [ ...common, ...console, ...dialogs, ...evaluate, ...files, ...install, ...keyboard, ...navigate, ...network, ...mouse, ...pdf, ...screenshot, ...snapshot, ...tabs, ...wait, ];
- src/browserServerBackend.ts:52-59 (registration)MCP ServerBackend implementation that dispatches tool calls to the specific handler (e.g., browser_snapshot) via tool.handle.async callTool(schema: mcpServer.ToolSchema<any>, parsedArguments: any) { const response = new Response(this._context, schema.name, parsedArguments); const tool = this._tools.find(tool => tool.schema.name === schema.name)!; await tool.handle(this._context, parsedArguments, response); if (this._sessionLog) await this._sessionLog.log(response); return await response.serialize(); }
- src/browserServerBackend.ts:48-50 (registration)MCP ServerBackend provides the tool schemas, including browser_snapshot, for listing in MCP protocol.tools(): mcpServer.ToolSchema<any>[] { return this._tools.map(tool => tool.schema); }
- src/loopTools/snapshot.ts:20-32 (handler)Secondary implementation in loopTools, likely for agent loop context, delegating to runTask for snapshot capture.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); }, });