android_launch_app
Launch Android applications by specifying their package name, enabling quick app access for testing or automation workflows.
Instructions
Launch an Android app by package name
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| packageName | Yes | Package name of the app to launch (e.g., com.example.app) | |
| deviceSerial | No | Specific device serial number to target (optional) |
Implementation Reference
- src/handlers.ts:206-230 (handler)Core handler function for the 'android_launch_app' tool. Validates arguments, calls ADBWrapper.launchApp, and returns success/error response.export async function launchAppHandler( adb: ADBWrapper, args: any ): Promise<{ content: Array<{ type: string; text: string }> }> { const { packageName, deviceSerial } = args as LaunchAppArgs; if (!packageName || typeof packageName !== 'string') { throw new Error('Invalid package name: packageName must be a non-empty string'); } try { await adb.launchApp(packageName, deviceSerial); return { content: [ { type: 'text', text: `Successfully launched app: ${packageName}`, }, ], }; } catch (error) { throw new Error(`Launch app failed: ${error instanceof Error ? error.message : String(error)}`); } }
- src/index.ts:120-137 (schema)MCP tool schema definition for 'android_launch_app', including input schema with packageName (required) and optional deviceSerial.{ name: 'android_launch_app', description: 'Launch an Android app by package name', inputSchema: { type: 'object', properties: { packageName: { type: 'string', description: 'Package name of the app to launch (e.g., com.example.app)', }, deviceSerial: { type: 'string', description: 'Specific device serial number to target (optional)', }, }, required: ['packageName'], }, },
- src/index.ts:470-471 (registration)Tool dispatch registration in the CallToolRequestSchema handler switch statement.case 'android_launch_app': return await launchAppHandler(this.adb, args);
- src/handlers.ts:24-27 (schema)TypeScript interface defining input arguments for the launchAppHandler.interface LaunchAppArgs { packageName: string; deviceSerial?: string; }
- src/adb-wrapper.ts:363-366 (helper)Low-level ADB command execution: launches app using 'adb shell monkey -p <package> -c android.intent.category.LAUNCHER 1'async launchApp(packageName: string, deviceSerial?: string): Promise<void> { const device = await this.getTargetDevice(deviceSerial); await this.exec(['shell', 'monkey', '-p', packageName, '-c', 'android.intent.category.LAUNCHER', '1'], device); }