record_screen
Record Android device screen activity to specified output file for set duration to capture visual workflows and interactions.
Instructions
Record the screen of the connected Android device for a specified duration
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| output_path | Yes | ||
| duration | Yes |
Implementation Reference
- src/espresso_mcp/server.py:203-224 (handler)The handler function for the 'record_screen' tool, decorated with @mcp.tool() for registration. It records the Android device screen using 'adb shell screenrecord' for the specified duration and pulls the MP4 file to the local output_path.@mcp.tool() def record_screen(output_path: str, duration: int) -> str: """Record the screen of the connected Android device for a specified duration""" timestamp = datetime.now().strftime("%Y%m%d%H%M%S") file = f"/sdcard/espresso-mcp_recording_{timestamp}.mp4" result = subprocess.run( ["adb", "shell", "screenrecord", file], capture_output=True, text=True, timeout=duration, ) if result.returncode != 0: raise RuntimeError(f"Error recording screen: {result.stderr}") pull_result = subprocess.run( ["adb", "pull", file, output_path], capture_output=True, text=True, ) if pull_result.returncode != 0: raise RuntimeError(f"Error pulling recorded file: {pull_result.stderr}") return f"Screen recording saved to '{output_path}'."