capture_screen_for_comparison
Capture device screenshots with metadata to compare visual designs against Figma mockups during Android app development and testing.
Instructions
Capture screenshot with metadata for visual comparison. Saves PNG and returns info for comparing with Figma designs.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| screen_name | Yes | ||
| output_dir | No | ./screenshots | |
| device_serial | No |
Implementation Reference
- src/adb_mcp_server/server.py:1142-1177 (handler)The primary handler function decorated with @mcp.tool(), which implements the capture_screen_for_comparison tool. It takes a screen_name, optional output_dir and device_serial, captures the screen using ADB screencap, saves the PNG file locally, and returns comprehensive metadata including device specs, current activity, file info, and base64-encoded image.@mcp.tool() def capture_screen_for_comparison( screen_name: str, output_dir: str = "./screenshots", device_serial: str | None = None ) -> dict: """ Capture screenshot with metadata for visual comparison. Saves PNG and returns info for comparing with Figma designs. """ os.makedirs(output_dir, exist_ok=True) # Get device specs specs = get_screen_specs(device_serial) activity = get_current_activity(device_serial) # Capture screenshot timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") filename = f"{screen_name}_{timestamp}.png" filepath = os.path.join(output_dir, filename) img_data = run_adb_binary(["exec-out", "screencap", "-p"], device_serial) with open(filepath, 'wb') as f: f.write(img_data) return { "filepath": filepath, "filename": filename, "screen_name": screen_name, "timestamp": timestamp, "device_specs": specs, "current_activity": activity, "size_bytes": len(img_data), "base64": base64.b64encode(img_data).decode('utf-8') }