screenshot
Capture and save screenshots of web pages directly from the Chromium ARM64 Browser. Define file names and choose between full-page or viewport captures for precise documentation and testing.
Instructions
Take a screenshot of the current page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fullPage | No | Capture full page | |
| name | No | Name for the screenshot file | screenshot.png |
Implementation Reference
- index.js:612-635 (handler)Core handler for the 'screenshot' MCP tool. Uses Chrome DevTools Protocol (CDP) to capture page screenshot, supports full-page mode by clipping to content size, decodes base64 PNG and saves to /tmp/{name}, returns path.async screenshot(name, fullPage) { await this.ensureChromium(); const screenshotParams = { format: 'png' }; if (fullPage) { const metrics = await this.sendCDPCommand('Page.getLayoutMetrics'); screenshotParams.clip = { x: 0, y: 0, width: metrics.contentSize.width, height: metrics.contentSize.height, scale: 1 }; } const result = await this.sendCDPCommand('Page.captureScreenshot', screenshotParams); const screenshotPath = `/tmp/${name}`; fs.writeFileSync(screenshotPath, result.data, 'base64'); return { content: [{ type: 'text', text: `Screenshot saved to ${screenshotPath}` }], }; }
- index.js:120-137 (schema)JSON schema definition for the screenshot tool's input parameters in the listTools response.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.js:355-356 (registration)Tool dispatch/registration in the CallToolRequestSchema switch statement, mapping 'screenshot' calls to the handler method.case 'click': return await this.click(args.selector);
- arm64_browser_tools.py:61-104 (helper)Python helper wrapper that invokes the MCP 'screenshot' tool via subprocess JSON-RPC call to index.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}"