screenshot
Capture webpage screenshots for documentation, testing, or debugging using the Chromium ARM64 Browser MCP server. Save screenshots as PNG files with options for full-page capture.
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 for the 'screenshot' tool. Uses CDP to capture screenshot (full page optional) and saves PNG to /tmp/{name}.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:130-147 (schema)Input schema definition for the screenshot tool, specifying 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 (registration)Registration/dispatch in the CallToolRequestSchema handler: maps 'screenshot' tool calls to the screenshot handler method.case 'screenshot': return await this.screenshot(args.name, args.fullPage);
- arm64_browser_tools.py:61-105 (helper)Python helper wrapper that invokes the MCP 'screenshot' tool via subprocess on the JS server.def arm64_browser_screenshot(name: str = "screenshot.png", full_page: bool = False) -> str: """Take a screenshot using ARM64 Chromium browser. Args: name: Filename for the screenshot full_page: Whether to capture the full page Returns: Path to screenshot file or error message """ request = { "jsonrpc": "2.0", "method": "tools/call", "params": {"name": "screenshot", "arguments": {"name": name, "fullPage": full_page}}, "id": 1 } try: result = subprocess.run( ["node", INDEX_PATH], input=json.dumps(request), text=True, capture_output=True, timeout=30, cwd=SERVER_DIR ) # Parse both stdout and stderr for JSON responses all_output = result.stdout + result.stderr lines = [line for line in all_output.strip().split('\n') if line.startswith('{"')] for line in lines: try: response = json.loads(line) if 'result' in response: content = response.get('result', {}).get('content', [{}]) return content[0].get('text', f'Screenshot saved as {name}') except json.JSONDecodeError: continue return f"No valid response found. Output: {all_output[:200]}" except Exception as e: return f"Screenshot error: {e}"