browser_snapshot
Capture accessibility snapshots of web pages to analyze structure and identify potential issues for improved user experience.
Instructions
Capture accessibility snapshot of the current page
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "browser_snapshot"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server.ts:216-234 (handler)The primary handler function for the 'browser_snapshot' tool. It ensures the browser and page are initialized, retrieves the current page's title and URL, and returns a textual snapshot response.
private async handleSnapshot() { await this.ensureBrowser(); // Get page content and create a simple snapshot const title = await this.browserState.page!.title(); const url = this.browserState.page!.url(); return { content: [ { type: 'text', text: `Page Snapshot: Title: ${title} URL: ${url} [Use browser_click, browser_type tools to interact with elements]`, }, ], }; } - src/server.ts:77-80 (schema)Input schema for the 'browser_snapshot' tool, defining an empty object (no required parameters).
inputSchema: { type: 'object', properties: {}, }, - src/server.ts:74-81 (registration)Registration entry for the 'browser_snapshot' tool in the ListToolsRequestSchema response, including name, description, and input schema.
{ name: 'browser_snapshot', description: 'Capture accessibility snapshot of the current page', inputSchema: { type: 'object', properties: {}, }, }, - src/server.ts:160-161 (registration)Dispatch registration in the CallToolRequestSchema switch statement, routing calls to the handleSnapshot() function.
case 'browser_snapshot': return await this.handleSnapshot();