Skip to main content
Glama

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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) }) }] };
        }
      },
    );
  • 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;
    }
Install Server

Other Tools

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/yfe404/proxy-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server