Skip to main content
Glama

uninstall_app

Remove applications from Android devices by specifying package names, enabling app management through the Android MCP Server's device control capabilities.

Instructions

Uninstall an application from the Android device. Requires allowDestructiveOps to be enabled in server configuration.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
package_nameYesAndroid package name to uninstall
device_idNoDevice serial number

Implementation Reference

  • The actual implementation of the uninstall logic that executes the ADB command.
    export async function uninstallApp(packageName: string, deviceId?: string): Promise<string> {
      const config = getConfig();
      if (!config.allowDestructiveOps) {
        throw new SecurityError(
          'Uninstall is a destructive operation. Set allowDestructiveOps=true in config to enable.',
          { packageName }
        );
      }
    
      const resolved = await deviceManager.resolveDeviceId(deviceId);
      validatePackageName(packageName);
    
      const result = await adbShell(['pm', 'uninstall', packageName], resolved);
    
      if (result.stdout.includes('Success')) {
        log.info('App uninstalled', { packageName, deviceId: resolved });
        return `Successfully uninstalled: ${packageName}`;
      }
    
      throw new Error(`Uninstall failed: ${result.stdout} ${result.stderr}`);
    }
  • MCP tool registration for 'uninstall_app'.
    server.registerTool(
      'uninstall_app',
      {
        description: 'Uninstall an application from the Android device. Requires allowDestructiveOps to be enabled in server configuration.',
        inputSchema: {
          package_name: z.string().describe('Android package name to uninstall'),
          device_id: z.string().optional().describe('Device serial number'),
        },
      },
      async ({ package_name, device_id }) => {
        return await metrics.measure('uninstall_app', device_id || 'default', async () => {
          const result = await uninstallApp(package_name, device_id);
          return {
            content: [{
              type: 'text' as const,
              text: JSON.stringify({ success: true, message: result }, 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