adb_list_apps
List installed applications on an Android device to manage apps or troubleshoot issues. Use this tool to retrieve app packages and names from connected devices.
Instructions
List installed apps on the device
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deviceId | No | Device ID (optional) |
Implementation Reference
- src/tools/app.ts:161-204 (handler)The handler function `listInstalledApps` that lists installed third-party apps using `adb shell pm list packages -3`, parses the output, and returns a structured response.async listInstalledApps(deviceId?: string) { try { const connected = await this.adbClient.isDeviceConnected(deviceId); if (!connected) { return { success: false, error: 'Device not connected', message: 'Cannot list apps - device is not connected' }; } const command = 'shell pm list packages -3'; const result = await this.adbClient.executeCommand(command, deviceId); if (!result.success) { return { success: false, error: result.error, message: 'Failed to list installed apps' }; } const packages = result.output .split('\n') .map(line => line.replace('package:', '').trim()) .filter(line => line.length > 0); return { success: true, data: { packages, count: packages.length, deviceId: deviceId || this.adbClient.getDefaultDevice() }, message: `Found ${packages.length} installed apps` }; } catch (error: any) { return { success: false, error: error.message, message: 'Failed to list installed apps' }; } }
- src/index.ts:277-290 (schema)Tool schema definition in the ListTools response, specifying name, description, and optional deviceId input.{ name: 'adb_list_apps', description: 'List installed apps on the device', inputSchema: { type: 'object', properties: { deviceId: { type: 'string', description: 'Device ID (optional)', }, }, required: [], }, },
- src/index.ts:461-462 (registration)Registration and dispatch in the CallToolRequest switch statement, mapping the tool name to the AppTools.listInstalledApps handler.case 'adb_list_apps': return await this.handleToolCall(this.appTools.listInstalledApps(args?.deviceId as string));