Skip to main content
Glama

record_screen

Capture Android device screen activity by specifying output path and recording duration using the screen recording tool on espresso-mcp server.

Instructions

Record the screen of the connected Android device for a specified duration

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
durationYes
output_pathYes

Implementation Reference

  • The handler function for the 'record_screen' tool. It uses ADB to record the screen of a connected Android device/emulator for the specified duration, saves it temporarily on the device, pulls it to the local output_path, and returns a success message. The @mcp.tool() decorator also handles registration with the FastMCP server.
    @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}'."

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/vs4vijay/espresso-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server