interceptor_android_devices
Monitor and manage Android devices connected to a network proxy for traffic interception, modification, and analysis during development and testing.
Instructions
List connected Android devices via ADB with model, version, root status, and whether they're actively intercepted.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/interceptors.ts:522-547 (handler)Tool registration and handler for 'interceptor_android_devices' in the tools file. It calls adb.listDevices() on the Android ADB interceptor.
server.tool( "interceptor_android_devices", "List connected Android devices via ADB with model, version, root status, and whether they're actively intercepted.", {}, async () => { try { const adb = interceptorManager.get("android-adb") as AndroidAdbInterceptor | undefined; if (!adb) { return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: "Android ADB interceptor not registered." }) }] }; } const activable = await adb.isActivable(); if (!activable) { return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: "ADB not found. Install Android platform-tools." }) }] }; } const devices = await adb.listDevices(); return { content: [{ type: "text", text: JSON.stringify({ status: "success", devices }), }], }; } catch (e) { return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: errorToString(e) }) }] }; } }, ); - src/interceptors/android-adb.ts:96-111 (handler)The core implementation of the tool logic (listDevices) in the AndroidAdbInterceptor class.
async listDevices(): Promise<Array<Record<string, unknown>>> { const { stdout } = await execFileAsync("adb", ["devices", "-l"], { timeout: 10000 }); const lines = stdout.trim().split("\n").slice(1); // Skip "List of devices" header const devices: Array<Record<string, unknown>> = []; for (const line of lines) { const parts = line.trim().split(/\s+/); if (parts.length < 2 || parts[1] !== "device") continue; const serial = parts[0]; const info = await getDeviceInfo(serial); const hasRoot = await checkRoot(serial); devices.push({ ...info, hasRoot, active: this.devices.has(`adb_${serial}`) }); } return devices; }