install_apk
Install APK files on Android devices using ADB commands. Specify the local APK file path and optional device ID to deploy applications to connected devices.
Instructions
Install an APK file on the device
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| apk_path | Yes | Local path to the APK file | |
| device_id | No | Device ID (optional if only one device) |
Implementation Reference
- src/adb.ts:338-345 (handler)The `installApk` method in the `Adb` class, which handles the execution of the `adb install -r` command to install an APK file on a device.
async installApk(apkPath: string, deviceId?: string): Promise<string> { const fullArgs = deviceId ? ["-s", deviceId, "install", "-r", apkPath] : ["install", "-r", apkPath]; const { stdout } = await execFileAsync(this.adbPath, fullArgs, { timeout: 60_000, maxBuffer: 10 * 1024 * 1024, }); return stdout; } - src/index.ts:473-484 (registration)Registration of the `install_apk` tool, which maps the input arguments to the `adb.installApk` method call.
server.tool( "install_apk", "Install an APK file on the device", { apk_path: z.string().describe("Local path to the APK file"), device_id: z.string().optional().describe("Device ID (optional if only one device)"), }, async ({ apk_path, device_id }) => { const result = await adb.installApk(apk_path, device_id); return { content: [{ type: "text", text: result.trim() }] }; }, );