launchApp
Automatically launch apps using their package ID on Android devices. Choose to clear app data or perform a cold boot for precise test scenarios.
Instructions
Launch an app by package name
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| appId | Yes | App package ID of the app | |
| clearAppData | No | Whether to clear app data before launching, default false | |
| coldBoot | No | Whether to cold boot the app, default true |
Implementation Reference
- src/server/appTools.ts:43-61 (handler)The registered handler function for the 'launchApp' MCP tool. It instantiates the LaunchApp class and calls its execute method with provided arguments.const launchAppHandler = async (device: BootedDevice, args: LaunchAppActionArgs) => { try { const launchApp = new LaunchApp(device); const result = await launchApp.execute( args.appId, args.clearAppData || false, args.coldBoot || true, undefined ); return createJSONToolResponse({ message: `Launched app ${args.appId}`, observation: result.observation, ...result }); } catch (error) { throw new ActionableError(`Failed to launch app: ${error}`); } };
- src/server/appTools.ts:14-18 (schema)Zod schema defining the input parameters for the launchApp tool.export const launchAppSchema = z.object({ appId: z.string().describe("App package ID of the app"), clearAppData: z.boolean().optional().describe("Whether to clear app data before launching, default false"), coldBoot: z.boolean().optional().describe("Whether to cold boot the app, default true"), });
- src/server/appTools.ts:95-100 (registration)Registration of the 'launchApp' tool with ToolRegistry, associating name, description, schema, and handler.ToolRegistry.registerDeviceAware( "launchApp", "Launch an app by package name", launchAppSchema, launchAppHandler );
- src/server/appTools.ts:29-33 (schema)TypeScript interface matching the launchApp schema for type safety in the handler.export interface LaunchAppActionArgs { appId: string; clearAppData?: boolean; coldBoot?: boolean; }
- src/features/action/LaunchApp.ts:145-160 (handler)Core execute method in LaunchApp class that handles platform-specific app launching logic (delegates to iOS/Android implementations).async execute( packageName: string, clearAppData: boolean, coldBoot: boolean, activityName?: string ): Promise<LaunchAppResult> { logger.info("execute"); switch (this.device.platform) { case "ios": return this.executeiOS(packageName, clearAppData, coldBoot); case "android": return this.executeAndroid(packageName, clearAppData, coldBoot, activityName); default: throw new ActionableError(`Unsupported platform: ${this.device.platform}`); } }
- src/models/LaunchAppResult.ts:6-12 (schema)TypeScript interface defining the structure of the launchApp result object.export interface LaunchAppResult { success: boolean; packageName: string; activityName?: string; observation?: ObserveResult; error?: string; }