list_apps
Retrieve a list of installed applications on an Android device, with options to filter system apps and specify target devices.
Instructions
List installed applications on the Android device. By default shows third-party apps only.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| include_system | No | Include system apps in the list | |
| device_id | No | Device serial number |
Implementation Reference
- src/adb/app-manager.ts:21-37 (handler)The handler function `listApps` that executes the ADB commands to list applications.
export async function listApps(deviceId?: string, includeSystem: boolean = false): Promise<AppInfo[]> { const resolved = await deviceManager.resolveDeviceId(deviceId); const flag = includeSystem ? '' : '-3'; // -3 = third-party only const args = flag ? ['pm', 'list', 'packages', flag] : ['pm', 'list', 'packages']; const result = await adbShell(args, resolved); const apps: AppInfo[] = result.stdout .split('\n') .filter(line => line.startsWith('package:')) .map(line => ({ packageName: line.replace('package:', '').trim(), })); log.info(`Listed ${apps.length} apps`, { deviceId: resolved, includeSystem }); return apps; } - src/controllers/app-tools.ts:18-39 (registration)Tool registration for 'list_apps' within the MCP server.
export function registerAppTools(server: McpServer): void { server.registerTool( 'list_apps', { description: 'List installed applications on the Android device. By default shows third-party apps only.', inputSchema: { include_system: z.boolean().optional().default(false).describe('Include system apps in the list'), device_id: z.string().optional().describe('Device serial number'), }, }, async ({ include_system, device_id }) => { return await metrics.measure('list_apps', device_id || 'default', async () => { const apps = await listApps(device_id, include_system); return { content: [{ type: 'text' as const, text: JSON.stringify({ success: true, count: apps.length, apps }, null, 2), }], }; }); } );