screenshot
Capture screenshots of web pages for documentation, testing, or sharing purposes using browser automation on ARM64 devices.
Instructions
Take a screenshot of the current page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Name for the screenshot file | screenshot.png |
| fullPage | No | Capture full page |
Implementation Reference
- index-browser-only.js:350-380 (handler)Main handler function that executes the screenshot tool logic: ensures Chromium is running, optionally sets full-page metrics, captures screenshot via Page.captureScreenshot CDP command, saves as PNG to /tmp/, and returns success message.async screenshot(name = 'screenshot.png', fullPage = false) { await this.ensureChromium(); const screenshotParams = { format: 'png' }; if (fullPage) { const metrics = await this.sendCDPCommand('Page.getLayoutMetrics'); await this.sendCDPCommand('Emulation.setDeviceMetricsOverride', { width: metrics.contentSize.width, height: metrics.contentSize.height, deviceScaleFactor: 1, mobile: false, }); screenshotParams.clip = { x: 0, y: 0, width: metrics.contentSize.width, height: metrics.contentSize.height, scale: 1, }; } const screenshot = await this.sendCDPCommand('Page.captureScreenshot', screenshotParams); const screenshotPath = `/tmp/${name}`; fs.writeFileSync(screenshotPath, screenshot.data, 'base64'); return { content: [{ type: 'text', text: `Screenshot saved to ${screenshotPath}` }], }; }
- index-browser-only.js:129-147 (registration)Registration of the 'screenshot' tool in the ListToolsRequestSchema handler, defining name, description, and input schema for parameters 'name' and 'fullPage'.{ name: 'screenshot', description: 'Take a screenshot of the current page', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name for the screenshot file', default: 'screenshot.png', }, fullPage: { type: 'boolean', description: 'Capture full page', default: false, }, }, }, },
- index-browser-only.js:182-183 (handler)Dispatch handler in CallToolRequestSchema switch statement that invokes the screenshot method with parsed arguments.case 'screenshot': return await this.screenshot(args.name, args.fullPage);