Skip to main content
Glama

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
NameRequiredDescriptionDefault
include_systemNoInclude system apps in the list
device_idNoDevice serial number

Implementation Reference

  • 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;
    }
  • 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),
              }],
            };
          });
        }
      );

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/divineDev-dotcom/android_mcp'

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