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
| Name | Required | Description | Default |
|---|---|---|---|
| package_name | Yes | Android package name to uninstall | |
| device_id | No | Device serial number |
Implementation Reference
- src/adb/app-manager.ts:92-112 (handler)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}`); } - src/controllers/app-tools.ts:149-169 (registration)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), }], }; }); } );