Skip to main content
Glama

take_screenshot

Capture a screenshot from a connected Android device and save it to a specified output path.

Instructions

Take a screenshot of the connected Android device

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
output_pathYes

Implementation Reference

  • The handler function for the 'take_screenshot' tool. It uses adb to capture a screenshot from the Android device, pulls it locally, resizes it using PIL, saves to the output_path, and returns a confirmation message.
    @mcp.tool()
    def take_screenshot(output_path: str) -> str:
        """Take a screenshot of the connected Android device"""
    
        timestamp = datetime.now().strftime("%Y%m%d%H%M%S")
        file = f"/sdcard/espresso-mcp_screenshot_{timestamp}.mp4"
    
        # Capture screenshot on the device
        subprocess.run(["adb", "shell", "screencap", "-p", file], check=True)
        # Pull the screenshot to the local machine
        subprocess.run(["adb", "pull", file, "screenshot.png"], check=True)
        # Remove the screenshot from the device
        subprocess.run(["adb", "shell", "rm", file], check=True)
    
        # Compress the screenshot to reduce size
        with PILImage.open("screenshot.png") as img:
            width, height = img.size
            new_width = int(width * 0.3)
            new_height = int(height * 0.3)
            resized_img = img.resize((new_width, new_height), PILImage.Resampling.LANCZOS)
            resized_img.save(output_path, "PNG", quality=85, optimize=True)
    
        return f"Screenshot saved to '{output_path}'."
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the action but doesn't cover critical aspects like whether this requires specific permissions, if it captures the entire screen or a region, the output format (e.g., PNG, JPEG), or any side effects like pausing the device. This leaves significant gaps for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that efficiently conveys the core purpose without unnecessary words. It's appropriately sized and front-loaded, with every word earning its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool that performs a mutation (taking a screenshot) with no annotations, no output schema, and 1 undocumented parameter, the description is incomplete. It lacks details on behavior, output, and parameter meaning, making it inadequate for safe and effective use by an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 1 parameter with 0% description coverage, and the tool description provides no information about the 'output_path' parameter. It doesn't explain what this path represents (e.g., local file path, device storage), expected format, or constraints, failing to compensate for the schema's lack of documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('take a screenshot') and the target resource ('connected Android device'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'record_screen' or 'dump_ui_hierarchy' which are also visual capture tools, so it doesn't reach the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'record_screen' or 'dump_ui_hierarchy', nor does it mention prerequisites such as device connectivity. It simply states what the tool does without context for selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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