listApps
List all installed applications on Android or iOS devices. Use this tool to retrieve app details for automation testing with AutoMobile.
Instructions
List all apps installed on the device
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| platform | Yes | Target platform |
Implementation Reference
- src/server/observeTools.ts:32-44 (handler)The handler function for the listApps MCP tool. It instantiates ListInstalledApps with the device and calls execute() to retrieve the list of installed apps, then formats and returns the result as JSON.const listAppsHandler = async (device: BootedDevice) => { try { const listInstalledApps = new ListInstalledApps(device); const apps = await listInstalledApps.execute(); return createJSONToolResponse({ message: `Listed ${apps.length} apps`, apps }); } catch (error) { throw new ActionableError(`Failed to list apps: ${error}`); } };
- src/server/observeTools.ts:14-16 (schema)Zod schema defining the input parameters for the listApps tool, requiring the target platform.export const listAppsSchema = z.object({ platform: z.enum(["android", "ios"]).describe("Target platform") });
- src/server/observeTools.ts:54-59 (registration)Registration of the listApps tool with the ToolRegistry using the device-aware method, providing name, description, schema, and handler.ToolRegistry.registerDeviceAware( "listApps", "List all apps installed on the device", listAppsSchema, listAppsHandler );
- The execute method of ListInstalledApps class, containing the platform-specific logic to list installed apps using simctl for iOS or adb for Android. This is called by the listApps handler.async execute(): Promise<string[]> { try { switch (this.device.platform) { case "ios": // iOS device - use idb to get installed apps const apps = await this.simctl.listApps(); return apps.map((app: any) => app.bundleId); case "android": // Android device - use adb to get installed apps const { stdout } = await this.adb.executeCommand("shell pm list packages"); return stdout .split("\n") .filter(line => line.startsWith("package:")) .map(line => line.replace("package:", "").trim()); default: throw new ActionableError(`Unsupported platform: ${this.device.platform}`); } } catch (error) { logger.warn("Failed to list installed apps:", error); return []; // Return empty array on error } }