Skip to main content
Glama

listDevices

Retrieve all connected Android and iOS devices, including physical and virtual devices, for mobile automation testing and management.

Instructions

List all connected devices (both physical and virtual devices)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
platformYesTarget platform

Implementation Reference

  • Handler function that lists booted devices for the given platform, categorizes them as virtual or physical, and returns formatted JSON response.
    const listBootedDevicesHandler = async (args: ListDevicesArgs) => { try { const deviceUtils = new DeviceUtils(); const bootedDevices = await deviceUtils.getBootedDevices(args.platform); // Categorize devices by type const devices = bootedDevices.map(device => { // For Android: emulator devices have deviceId starting with "emulator-" // For iOS: simulator devices typically have deviceId as UUID format or contain "simulator" const isVirtual = args.platform === "android" ? device.deviceId.startsWith("emulator-") : device.deviceId.includes("-") && device.deviceId.length > 30; // iOS simulators typically have long UUID-like IDs return { ...device, isVirtual }; }); const virtualCount = devices.filter(d => d.isVirtual).length; const physicalCount = devices.filter(d => !d.isVirtual).length; return createJSONToolResponse({ message: `Found ${devices.length} connected ${args.platform} devices`, devices: devices, totalCount: devices.length, virtualCount: virtualCount, physicalCount: physicalCount, platform: args.platform }); } catch (error) { throw new ActionableError(`Failed to list ${args.platform} devices: ${error}`); } };
  • Zod schema defining the input parameters for the listDevices tool: requires 'platform' as 'android' or 'ios'.
    export const listDevicesSchema = z.object({ platform: z.enum(["android", "ios"]).describe("Target platform") });
  • Registration of the listDevices tool with the ToolRegistry, linking name, description, schema, and handler.
    ToolRegistry.register( "listDevices", "List all connected devices (both physical and virtual devices)", listDevicesSchema, listBootedDevicesHandler );

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/zillow/auto-mobile'

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