Skip to main content
Glama

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
NameRequiredDescriptionDefault
platformYesTarget platform

Implementation Reference

  • 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}`); } };
  • 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") });
  • 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 } }

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/zillow/auto-mobile'

If you have feedback or need assistance with the MCP directory API, please join our Discord server