Skip to main content
Glama

list_emulators

Retrieve a list of all available Android emulators and devices with their names, IDs, status, and screen dimensions for automation setup.

Instructions

List all available Android emulators and devices with their name, ID, status, and dimensions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function decorated with @mcp.tool() that implements the list_emulators tool. It uses ADB to list connected devices/emulators, fetches additional info like AVD name/model and screen dimensions, and returns a structured list.
    @mcp.tool()
    async def list_emulators() -> dict:
        """List all available Android emulators and devices with their name, ID, status, and dimensions"""
        try:
            # Execute adb devices to get connected devices/emulators
            result = subprocess.run(['adb', 'devices'], capture_output=True, text=True, check=True)
    
            devices = []
            lines = result.stdout.strip().split('\n')[1:]  # Skip header line
    
            for line in lines:
                if line.strip():
                    parts = line.strip().split('\t')
                    if len(parts) >= 2:
                        device_id = parts[0]
                        status = parts[1]
    
                        # Try to get AVD name if it's an emulator
                        avd_name = "Unknown"
                        if device_id.startswith('emulator-'):
                            try:
                                avd_result = subprocess.run(
                                    ['adb', '-s', device_id, 'emu', 'avd', 'name'],
                                    capture_output=True, text=True, timeout=5
                                )
                                if avd_result.returncode == 0:
                                    avd_name = avd_result.stdout.strip()
                            except (subprocess.TimeoutExpired, subprocess.CalledProcessError):
                                pass
                        else:
                            # For physical devices, try to get device model
                            try:
                                model_result = subprocess.run(
                                    ['adb', '-s', device_id, 'shell', 'getprop', 'ro.product.model'],
                                    capture_output=True, text=True, timeout=5
                                )
                                if model_result.returncode == 0:
                                    avd_name = model_result.stdout.strip()
                            except (subprocess.TimeoutExpired, subprocess.CalledProcessError):
                                pass
    
                        # Get device dimensions
                        width, height, dimensions = None, None, None
                        try:
                            size_result = subprocess.run(
                                ['adb', '-s', device_id, 'shell', 'wm', 'size'],
                                capture_output=True, text=True, timeout=5
                            )
                            if size_result.returncode == 0:
                                output = size_result.stdout.strip()
                                if 'Physical size:' in output:
                                    size_part = output.split('Physical size:')[1].strip()
                                    width, height = map(int, size_part.split('x'))
                                    dimensions = f"{width}x{height}"
                        except (subprocess.TimeoutExpired, subprocess.CalledProcessError, ValueError):
                            pass
    
                        devices.append({
                            "id": device_id,
                            "name": avd_name,
                            "status": status,
                            "type": "emulator" if device_id.startswith('emulator-') else "device",
                            "width": width,
                            "height": height,
                            "dimensions": dimensions
                        })
    
            return {
                "success": True,
                "devices": devices,
                "count": len(devices)
            }
    
        except subprocess.CalledProcessError as e:
            return {
                "success": False,
                "error": f"Failed to execute adb command: {e}",
                "devices": [],
                "count": 0
            }
        except FileNotFoundError:
            return {
                "success": False,
                "error": "ADB not found. Please ensure Android SDK is installed and adb is in PATH.",
                "devices": [],
                "count": 0
            }
        except Exception as e:
            return {
                "success": False,
                "error": f"Unexpected error: {e}",
                "devices": [],
                "count": 0
            }
  • puppeteer.py:238-238 (registration)
    The @mcp.tool() decorator registers the list_emulators function as an MCP tool.
    @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 tool's behavior by specifying it lists 'all available' items and the returned attributes, but does not mention potential limitations (e.g., pagination, rate limits, or authentication needs). It adequately describes the core action but lacks deeper behavioral context.

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, efficient sentence that front-loads the purpose and details without waste. Every word contributes to understanding what the tool does and what information it returns, making it highly concise and well-structured.

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

Completeness4/5

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

Given the tool's simplicity (0 parameters, no annotations, no output schema), the description is complete enough for a list operation. It specifies the resource and returned attributes, though it could enhance completeness by mentioning the output format (e.g., list of objects) or any implicit constraints. Overall, it meets most needs for this low-complexity tool.

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 tool has 0 parameters with 100% schema description coverage, so the schema fully documents the absence of inputs. The description adds no parameter information, which is appropriate here. Baseline is 4 for zero parameters, as no compensation is needed.

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 verb 'List' and the resource 'Android emulators and devices', specifying the exact information returned (name, ID, status, dimensions). It distinguishes from siblings like 'get_device_dimensions' by indicating it lists multiple items with comprehensive details rather than retrieving dimensions for a single device.

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

Usage Guidelines3/5

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

The description implies usage when needing a list of emulators/devices with their attributes, but does not explicitly state when to use this tool versus alternatives like 'get_device_dimensions' (which might fetch dimensions for a specific device). No exclusions or prerequisites are mentioned, leaving usage context somewhat implied.

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/pedro-rivas/android-puppeteer-mcp'

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