Skip to main content
Glama
rahulkr
by rahulkr

screenshot

Capture device screen images for UI testing, visual QA, and debugging workflows. Returns base64 PNG data for direct viewing.

Instructions

Take a screenshot of the device screen. Returns base64 encoded PNG image that can be viewed directly.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
device_serialNo

Implementation Reference

  • The main 'screenshot' MCP tool handler function. Decorated with @mcp.tool() for automatic registration and schema inference from signature/docstring. Captures device screenshot using ADB 'screencap', base64 encodes PNG, returns image metadata and data.
    @mcp.tool()
    def screenshot(device_serial: str | None = None) -> dict:
        """
        Take a screenshot of the device screen.
        Returns base64 encoded PNG image that can be viewed directly.
        """
        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"}
        
        img_base64 = base64.b64encode(img_data).decode('utf-8')
        return {
            "type": "image",
            "format": "png",
            "size_bytes": len(img_data),
            "data": img_base64
        }
  • Helper utility 'run_adb_binary' called by screenshot tool to execute ADB screencap command and capture binary PNG image data.
    def run_adb_binary(args: list[str], device_serial: str | None = None) -> bytes:
        """Run an ADB command and return binary output"""
        cmd = ["adb"]
        if device_serial:
            cmd.extend(["-s", device_serial])
        cmd.extend(args)
        
        result = subprocess.run(cmd, capture_output=True)
        return result.stdout
  • @mcp.tool() decorator on screenshot function registers it as an MCP tool with FastMCP server instance.
    @mcp.tool()
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses the output format (base64 PNG) and implies a read-only operation, but lacks details on permissions, device state requirements, or potential side effects (e.g., if it interrupts device usage).

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?

Two sentences that are front-loaded with the primary action and efficiently convey the return value. No wasted words or redundant information.

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

Completeness3/5

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

For a tool with no annotations, no output schema, and minimal parameters, the description adequately covers the basic purpose and output. However, it lacks context on error conditions, device compatibility, or how the base64 output should be handled, leaving gaps for an AI agent.

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

Parameters4/5

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

The description adds no parameter information beyond the schema (which has 0% coverage), but since there's only one optional parameter (device_serial), the tool's core functionality is clear without it. The baseline is high due to minimal parameter complexity.

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

Purpose5/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 ('device screen'), distinguishing it from sibling tools like 'screenshot_to_file' or 'capture_screen_for_comparison' by specifying the output format (base64 PNG).

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?

No explicit guidance on when to use this tool versus alternatives like 'screenshot_to_file' (which saves to a file) or 'capture_screen_for_comparison' (which may have different functionality). The description only states what it does, not when it's preferred.

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

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