Skip to main content
Glama

android_create_avd

Create an Android Virtual Device (AVD) for mobile app development and testing by specifying name, system image, and optional device configuration.

Instructions

Create a new Android Virtual Device (AVD)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesAVD name (alphanumeric and underscores only)
systemImageIdYesSystem image package ID
deviceNoDevice definition (optional)
sdcardNoSD card size (e.g., 512M, 1G)

Implementation Reference

  • Executes the android_create_avd tool: validates input with Zod, builds avdmanager command, runs it with 5min timeout, returns success with AVD details or throws on failure.
    handler: async (args: any) => {
      const validation = AndroidAvdCreateSchema.safeParse(args);
      if (!validation.success) {
        throw new Error(`Invalid request: ${validation.error.message}`);
      }
    
      const { name, systemImageId, sdcard, device } = validation.data;
    
      // Validate AVD name (only alphanumeric and underscores)
      if (!/^[a-zA-Z0-9_]+$/.test(name)) {
        throw new Error('AVD name can only contain alphanumeric characters and underscores');
      }
    
      const args_cmd = ['create', 'avd', '--name', name, '--package', systemImageId];
      
      if (device) {
        args_cmd.push('--device', device);
      }
      
      if (sdcard) {
        args_cmd.push('--sdcard', sdcard);
      }
    
      const result = await processExecutor.execute('avdmanager', args_cmd, {
        timeout: 300000, // 5 minutes timeout
      });
    
      if (result.exitCode !== 0) {
        throw new Error(`AVD creation failed: ${result.stderr}`);
      }
    
      return {
        success: true,
        data: {
          avdName: name,
          systemImage: systemImageId,
          output: result.stdout,
        },
      };
    }
  • Zod schema for android_create_avd input validation: requires name and systemImageId, optional device and sdcard.
    const AndroidAvdCreateSchema = z.object({
      name: z.string().min(1),
      systemImageId: z.string().min(1),
      device: z.string().optional(),
      sdcard: z.string().optional(),
    });
  • Registers the android_create_avd tool in the tools Map returned by createAndroidTools, including JSON inputSchema and reference to the Zod-validated handler.
    tools.set('android_create_avd', {
      name: 'android_create_avd',
      description: 'Create a new Android Virtual Device (AVD)',
      inputSchema: {
        type: 'object',
        properties: {
          name: { type: 'string', minLength: 1, description: 'AVD name (alphanumeric and underscores only)' },
          systemImageId: { type: 'string', minLength: 1, description: 'System image package ID' },
          device: { type: 'string', description: 'Device definition (optional)' },
          sdcard: { type: 'string', description: 'SD card size (e.g., 512M, 1G)' }
        },
        required: ['name', 'systemImageId']
      },
      handler: async (args: any) => {
        const validation = AndroidAvdCreateSchema.safeParse(args);
        if (!validation.success) {
          throw new Error(`Invalid request: ${validation.error.message}`);
        }
    
        const { name, systemImageId, sdcard, device } = validation.data;
    
        // Validate AVD name (only alphanumeric and underscores)
        if (!/^[a-zA-Z0-9_]+$/.test(name)) {
          throw new Error('AVD name can only contain alphanumeric characters and underscores');
        }
    
        const args_cmd = ['create', 'avd', '--name', name, '--package', systemImageId];
        
        if (device) {
          args_cmd.push('--device', device);
        }
        
        if (sdcard) {
          args_cmd.push('--sdcard', sdcard);
        }
    
        const result = await processExecutor.execute('avdmanager', args_cmd, {
          timeout: 300000, // 5 minutes timeout
        });
    
        if (result.exitCode !== 0) {
          throw new Error(`AVD creation failed: ${result.stderr}`);
        }
    
        return {
          success: true,
          data: {
            avdName: name,
            systemImage: systemImageId,
            output: result.stdout,
          },
        };
      }
    });
  • Metadata registration in TOOL_REGISTRY for tool categorization, platform, requirements (avdmanager), safety, and performance expectations.
    'android_create_avd': {
      name: 'android_create_avd',
      category: ToolCategory.ESSENTIAL,
      platform: 'android',
      requiredTools: [RequiredTool.AVDMANAGER],
      description: 'Create new Android Virtual Device',
      safeForTesting: false,
      performance: { expectedDuration: 5000, timeout: 60000 }
    },
  • Maps android_create_avd to required system tool 'avdmanager' for validation skipping if unavailable.
    'android_create_avd': 'avdmanager',
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 states the action ('Create') but does not explain what happens after creation (e.g., whether the AVD is started automatically, if it persists, or any permissions required). For a creation tool with zero annotation coverage, 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 front-loaded and wastes no space, making it easy to parse quickly.

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 complexity of creating an AVD (which may involve dependencies like system images or SDK setup), the description is insufficient. No annotations exist to cover behavioral aspects, and there is no output schema to explain return values. The description alone does not provide enough context for effective use, especially compared to sibling tools that might interact with AVDs.

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 input schema has 100% description coverage, with clear documentation for all 4 parameters (e.g., 'name' and 'systemImageId' are required, 'device' is optional). The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline of 3 for high schema coverage without compensating value.

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 ('Create') and resource ('Android Virtual Device (AVD)'), making the purpose immediately understandable. However, it does not differentiate from sibling tools like 'android_start_emulator' or 'flutter_launch_emulator', which might involve AVDs in different contexts, so it lacks explicit sibling distinction.

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. It does not mention prerequisites (e.g., needing an installed Android SDK or system images), nor does it clarify scenarios where this tool is appropriate compared to siblings like 'android_list_emulators' or 'flutter_setup_environment'.

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