Skip to main content
Glama

detox_list_devices

List available iOS simulators and Android emulators for mobile testing. Manage device selection in React Native E2E testing with the Detox framework.

Instructions

List available iOS simulators and Android emulators.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
platformNoall
availableOnlyNo

Implementation Reference

  • Main handler function that executes the logic for listing iOS simulators and Android emulators, filtering by platform and availability.
    export const listDevicesTool: Tool = {
      name: "detox_list_devices",
      description: "List available iOS simulators and Android emulators.",
      inputSchema: zodToJsonSchema(ListDevicesArgsSchema),
      handler: async (args: z.infer<typeof ListDevicesArgsSchema>) => {
        const parsed = ListDevicesArgsSchema.parse(args);
        const devices: any[] = [];
    
        if (parsed.platform === "all" || parsed.platform === "ios") {
          const iosDevices = await listIOSSimulators();
          devices.push(...iosDevices);
        }
    
        if (parsed.platform === "all" || parsed.platform === "android") {
          const androidDevices = await listAndroidEmulators();
          devices.push(...androidDevices);
        }
    
        let filteredDevices = devices;
        if (parsed.availableOnly) {
          filteredDevices = devices.filter(
            (d) => d.state === "Booted" || d.state === "available"
          );
        }
    
        return {
          success: true,
          devices: filteredDevices,
          total: filteredDevices.length,
        };
      },
    };
  • Zod schema defining the input parameters for the detox_list_devices tool: platform (ios/android/all) and availableOnly flag.
    export const ListDevicesArgsSchema = z.object({
      platform: z.enum(["ios", "android", "all"]).optional().default("all"),
      availableOnly: z.boolean().optional().default(false),
    });
    
    export type ListDevicesArgs = z.infer<typeof ListDevicesArgsSchema>;
  • Helper function to list available iOS simulators using xcrun simctl.
    export async function listIOSSimulators(): Promise<any[]> {
      const result = await executeCommand("xcrun simctl list devices --json");
      if (!result.success) {
        return [];
      }
    
      try {
        const data = JSON.parse(result.stdout);
        const devices: any[] = [];
    
        for (const [runtime, deviceList] of Object.entries(data.devices || {})) {
          if (Array.isArray(deviceList)) {
            for (const device of deviceList) {
              devices.push({
                id: device.udid,
                name: device.name,
                state: device.state,
                runtime: runtime.replace("com.apple.CoreSimulator.SimRuntime.", ""),
                platform: "ios",
              });
            }
          }
        }
    
        return devices;
      } catch {
        return [];
      }
    }
  • Helper function to list available Android emulators/AVDs using emulator -list-avds.
    export async function listAndroidEmulators(): Promise<any[]> {
      const result = await executeCommand("emulator -list-avds");
      if (!result.success) {
        return [];
      }
    
      const avdNames = result.stdout
        .split("\n")
        .map((line) => line.trim())
        .filter((line) => line.length > 0);
    
      return avdNames.map((name) => ({
        id: name,
        name,
        state: "available",
        platform: "android",
      }));
    }
  • The detox_list_devices tool (as listDevicesTool) is registered in the allTools array, which is imported and used by the MCP server to list and call tools.
    export const allTools: Tool[] = [
      buildTool,
      testTool,
      initTool,
      readConfigTool,
      listConfigurationsTool,
      validateConfigTool,
      createConfigTool,
      listDevicesTool,
      generateTestTool,
      generateMatcherTool,
      generateActionTool,
      generateExpectationTool,
    ];
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool lists 'available' devices, implying a read-only operation, but does not disclose other traits like error handling, performance characteristics, or whether it requires specific permissions or has rate limits. This leaves significant gaps in understanding the tool's behavior.

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 directly states the tool's purpose without unnecessary words. It is appropriately sized and front-loaded, making it easy to understand at a glance, with no wasted content.

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

Completeness2/5

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

Given the tool's complexity (listing devices with parameters), lack of annotations, no output schema, and low schema coverage, the description is incomplete. It does not explain return values, error conditions, or how parameters affect the listing, leaving the agent with insufficient information for effective use.

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

Parameters3/5

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

The description does not mention any parameters, and with 0% schema description coverage, the two parameters ('platform' and 'availableOnly') are undocumented in both the schema and description. Since schema coverage is low (<50%), the description fails to compensate by explaining parameter meanings, resulting in a baseline score due to lack of added value beyond the schema.

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

Purpose4/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 resources 'iOS simulators and Android emulators', providing a specific purpose. However, it does not explicitly differentiate from sibling tools like 'detox_list_configurations', which might list different resources, leaving some ambiguity in sibling differentiation.

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?

The description provides no guidance on when to use this tool versus alternatives, such as other list tools in the sibling set (e.g., 'detox_list_configurations'). It lacks explicit context, prerequisites, or exclusions, offering only a basic statement of function without usage instructions.

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/gayancliyanage/detox-mcp'

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