Skip to main content
Glama

list_devices

Retrieve details of all connected Android devices for development, testing, and debugging workflows.

Instructions

List all connected Android devices with details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'list_devices' tool. It is decorated with @mcp.tool() which registers it with the FastMCP server. The function executes `adb devices -l` via the run_adb helper to list connected Android devices with details.
    @mcp.tool() def list_devices() -> str: """List all connected Android devices with details""" return run_adb(["devices", "-l"])
  • Helper function used by list_devices to execute ADB commands safely, handling errors, timeouts, and device selection.
    def run_adb(args: list[str], device_serial: str | None = None, timeout: int = 30) -> str: """Run an ADB command and return output""" cmd = ["adb"] if device_serial: cmd.extend(["-s", device_serial]) cmd.extend(args) try: result = subprocess.run(cmd, capture_output=True, text=True, timeout=timeout) if result.returncode != 0 and result.stderr: return f"Error: {result.stderr}" return result.stdout except subprocess.TimeoutExpired: return "Error: Command timed out" except Exception as e: return f"Error: {str(e)}"

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