adb_install_app
Install APK files on Android devices using device-specific or default configurations. Streamline app deployment and management with direct integration into the ADB MCP Server for automated Android device operations.
Instructions
Install an APK file on the device
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| apkPath | Yes | Path to the APK file | |
| deviceId | No | Device ID (optional) |
Implementation Reference
- src/tools/app.ts:7-41 (handler)The core handler function in AppTools class that performs the ADB install command on the specified APK file, checks device connection, executes the command, and returns success/error details.async installApp(apkPath: string, deviceId?: string) { try { const connected = await this.adbClient.isDeviceConnected(deviceId); if (!connected) { return { success: false, error: 'Device not connected', message: 'Cannot install app - device is not connected' }; } const command = `install "${apkPath}"`; const result = await this.adbClient.executeCommand(command, deviceId); if (!result.success || result.output.includes('Failure')) { return { success: false, error: result.error || result.output, message: 'Failed to install app' }; } return { success: true, data: { apkPath, deviceId: deviceId || this.adbClient.getDefaultDevice() }, message: `App installed successfully from ${apkPath}` }; } catch (error: any) { return { success: false, error: error.message, message: 'Failed to install app' }; } }
- src/index.ts:201-218 (schema)The tool schema definition including name, description, and input schema (apkPath required, deviceId optional) used for tool listing and validation.{ name: 'adb_install_app', description: 'Install an APK file on the device', inputSchema: { type: 'object', properties: { apkPath: { type: 'string', description: 'Path to the APK file', }, deviceId: { type: 'string', description: 'Device ID (optional)', }, }, required: ['apkPath'], }, },
- src/index.ts:453-454 (registration)The switch case registration that dispatches calls to the adb_install_app tool to the AppTools.installApp method.case 'adb_install_app': return await this.handleToolCall(this.appTools.installApp(args?.apkPath as string, args?.deviceId as string));