Skip to main content
Glama

native_run_list_devices

List connected Android and iOS devices for mobile development testing and deployment using native-run commands.

Instructions

List connected devices using native-run (Android & iOS support)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
platformNoandroid

Implementation Reference

  • Handler function that validates input with Zod schema, checks if native-run is available, executes 'native-run [platform] --list --json', parses the JSON output or falls back to text line parsing, and returns a structured list of devices.
    handler: async (args: any) => {
      const parsed = NativeRunListDevicesSchema.parse(args);
      
      if (!(await isNativeRunAvailable())) {
        throw new Error('native-run is not installed. Install with: npm install -g native-run');
      }
    
      const result = await processExecutor.execute('native-run', [
        parsed.platform,
        '--list',
        '--json'
      ]);
    
      if (result.exitCode !== 0) {
        throw new Error(`Failed to list ${parsed.platform} devices: ${result.stderr}`);
      }
    
      let devices = [];
      try {
        const output = JSON.parse(result.stdout);
        devices = output.devices || [];
      } catch (parseError) {
        // If JSON parsing fails, try to parse text output
        devices = result.stdout
          .split('\n')
          .filter((line: string) => line.trim() && !line.includes('Available targets'))
          .map((line: string, index: number) => ({
            id: `device_${index}`,
            name: line.trim(),
            platform: parsed.platform,
            available: true
          }));
      }
    
      return {
        success: true,
        data: {
          platform: parsed.platform,
          devices,
          totalCount: devices.length,
          tool: 'native-run'
        },
      };
    }
  • Zod validation schema for the tool input, specifying the 'platform' parameter as an enum of 'android' or 'ios' with default 'android'.
    const NativeRunListDevicesSchema = z.object({
      platform: z.enum(['android', 'ios']).default('android'),
    });
  • Registers the 'native_run_list_devices' tool in the Map returned by createNativeRunTools(), including name, description, JSON input schema, and reference to the handler function.
    tools.set('native_run_list_devices', {
      name: 'native_run_list_devices',
      description: 'List connected devices using native-run (Android & iOS support)',
      inputSchema: {
        type: 'object',
        properties: {
          platform: {
            type: 'string',
            enum: ['android', 'ios'],
            default: 'android'
          }
        },
        required: []
      },
      handler: async (args: any) => {
        const parsed = NativeRunListDevicesSchema.parse(args);
        
        if (!(await isNativeRunAvailable())) {
          throw new Error('native-run is not installed. Install with: npm install -g native-run');
        }
    
        const result = await processExecutor.execute('native-run', [
          parsed.platform,
          '--list',
          '--json'
        ]);
    
        if (result.exitCode !== 0) {
          throw new Error(`Failed to list ${parsed.platform} devices: ${result.stderr}`);
        }
    
        let devices = [];
        try {
          const output = JSON.parse(result.stdout);
          devices = output.devices || [];
        } catch (parseError) {
          // If JSON parsing fails, try to parse text output
          devices = result.stdout
            .split('\n')
            .filter((line: string) => line.trim() && !line.includes('Available targets'))
            .map((line: string, index: number) => ({
              id: `device_${index}`,
              name: line.trim(),
              platform: parsed.platform,
              available: true
            }));
        }
    
        return {
          success: true,
          data: {
            platform: parsed.platform,
            devices,
            totalCount: devices.length,
            tool: 'native-run'
          },
        };
      }
    });
  • Helper function used by the handler to check if the native-run CLI is installed and available in the system PATH by attempting to run 'native-run --version'.
    async function isNativeRunAvailable(): Promise<boolean> {
      try {
        await processExecutor.execute('native-run', ['--version']);
        return true;
      } catch {
        return false;
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'Android & iOS support' but fails to describe critical behaviors like whether it lists physical devices only, emulators/simulators, output format, permissions required, or error handling. For a tool with zero annotation coverage, this leaves significant gaps in understanding its operation.

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 core purpose without unnecessary details. Every word contributes to understanding the tool's scope, making it appropriately concise and well-structured.

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 lack of annotations and output schema, the description is incomplete. It omits details about return values, error conditions, and how it differs from similar sibling tools. For a tool in a context with many device-related alternatives, more contextual information is needed to guide 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 the 'platform' parameter at all, and with 0% schema description coverage, the schema alone provides minimal context (only enum values and default). However, since there is only one optional parameter, the baseline is higher, but the description adds no value beyond what's inferred from the tool name and schema, resulting in an average score.

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 action ('List connected devices') and the technology scope ('using native-run (Android & iOS support)'), which distinguishes it from generic device listing tools. However, it doesn't explicitly differentiate from sibling tools like 'android_list_devices' or 'flutter_list_devices', which reduces the score from a perfect 5.

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 'android_list_devices' or 'flutter_list_devices', nor does it mention prerequisites or context for usage. It only states what the tool does, not when or why to choose it.

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/cristianoaredes/mcp-mobile-server'

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