Skip to main content
Glama

list_devices

Retrieve a list of all available mobile devices including iOS simulators, Android emulators, and connected real devices, with their platform and status.

Instructions

Liste tous les devices disponibles — simulateurs iOS, émulateurs Android, et vrais devices connectés. Affiche la plateforme et l'état de chaque device.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function that registers and implements the list_devices MCP tool. Calls getAllDevices(), getActiveDevice(), and formatDeviceList() to produce the output.
    export function registerListDevices(server: McpServer): void {
      server.tool(
        "list_devices",
        "Liste tous les devices disponibles — simulateurs iOS, émulateurs Android, et vrais devices connectés. Affiche la plateforme et l'état de chaque device.",
        {},
        async () => {
          const devices = await getAllDevices();
          const active = await getActiveDevice();
          let text = formatDeviceList(devices);
    
          if (active) {
            text += `\n\n**Device actif : ${active.name}** (${active.platform} ${active.type})`;
          }
    
          return { content: [{ type: "text", text }] };
        }
      );
  • Helper that gathers all devices from iOS simulators, iOS real devices, and Android (ADB) with 3-second caching.
    export async function getAllDevices(): Promise<DeviceInfo[]> {
      if (deviceListCache && Date.now() - deviceListCacheTime < CACHE_TTL_MS) {
        return deviceListCache;
      }
    
      const [iosSims, iosReal, android] = await Promise.all([
        listIosDevices(),
        listIosRealDevices(),
        listAndroidDevices(),
      ]);
      deviceListCache = [...iosReal, ...android, ...iosSims];
      deviceListCacheTime = Date.now();
      return deviceListCache;
    }
  • Helper that determines which device is currently active (manually selected or single booted device).
    export async function getActiveDevice(): Promise<DeviceInfo | null> {
      const booted = await getBootedDevices();
    
      // If a device was manually selected, find it
      if (selectedDeviceId) {
        const found = booted.find((d) => d.id === selectedDeviceId);
        if (found) return found;
        // Selected device no longer available — clear selection
        selectedDeviceId = null;
      }
    
      // Only one device booted — use it
      if (booted.length === 1) return booted[0];
    
      // Multiple or none — return null to trigger device selection
      return null;
    }
  • Helper that formats the device list into a human-readable string grouped by platform (iOS/Android) with status icons.
    export function formatDeviceList(devices: DeviceInfo[]): string {
      if (devices.length === 0) return "Aucun device disponible.";
    
      const lines: string[] = [];
    
      // Group by platform
      const ios = devices.filter((d) => d.platform === "ios");
      const android = devices.filter((d) => d.platform === "android");
    
      if (ios.length > 0) {
        lines.push("\n## iOS");
        for (const d of ios) {
          const icon = d.state === "booted" ? "🟢" : "⚪";
          const typeLabel = d.type === "device" ? " [real device]" : "";
          lines.push(`${icon} ${d.name}${typeLabel} — ${d.state} (${d.id})`);
        }
      }
    
      if (android.length > 0) {
        lines.push("\n## Android");
        for (const d of android) {
          const icon = "🟢"; // Android devices from ADB are always connected
          const typeLabel = d.type === "device" ? " [real device]" : " [emulator]";
          lines.push(`${icon} ${d.name}${typeLabel} (${d.id})`);
        }
      }
    
      return lines.join("\n");
    }
  • DeviceInfo type definition used across all device-related tools including list_devices.
    export interface DeviceInfo {
      id: string;
      name: string;
      platform: "ios" | "android";
      type: "simulator" | "emulator" | "device";
      state: "booted" | "shutdown";
    }
Behavior4/5

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

With no annotations, the description carries full burden. It discloses that the tool lists devices and shows platform and state, which is sufficient for a read-only operation. However, it does not mention if the list is cached or refreshed.

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, front-loaded with the purpose. No wasted words. Efficiently communicates the tool's functionality.

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?

The description says it shows platform and state, but does not specify the return format (e.g., list of device names, types, statuses). For a tool with no output schema, this lack of detail may leave the agent uncertain about what to expect.

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 no parameters, so the description is not expected to add parameter details. The schema coverage is 100% trivially, and the description does not need to compensate.

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 'devices', specifying types (simulators, emulators, real devices). It distinguishes from siblings like set_device and prepare_device by focusing on listing rather than selection or preparation.

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 you need to know available devices, but does not explicitly state when to use it versus alternatives like multi_device or prepare_device. No guidance on when not to use it is provided.

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/nthImpulse/phantom-mcp'

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