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',

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