Skip to main content
Glama

screenshot_to_file

Capture Android device screenshots and save them directly to local files for visual testing, debugging, or documentation purposes.

Instructions

Save screenshot to a local file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameNoscreenshot.png
device_serialNo

Implementation Reference

  • The handler function decorated with @mcp.tool(), implementing the screenshot_to_file tool. Captures screenshot using ADB screencap command and writes the binary PNG data to the specified local file.
    @mcp.tool() def screenshot_to_file( filename: str = "screenshot.png", device_serial: str | None = None ) -> str: """Save screenshot to a local file""" img_data = run_adb_binary(["exec-out", "screencap", "-p"], device_serial) if not img_data or len(img_data) < 100: return "Error: Failed to capture screenshot" with open(filename, 'wb') as f: f.write(img_data) return f"Screenshot saved to {filename} ({len(img_data)} bytes)"

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/rahulkr/r_adb_mcp_server'

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