Skip to content

device_info

Read-only introspection of currently connected devices.

adb_automation_mcp.modules.device_info.tools

Module-level, statically-introspectable tool functions for the device_info module.

Kept as plain top-level functions, never closures, so that documentation tooling and the registry meta-test can both introspect them directly.

list_connected_devices(ctx: Context) -> list[ConnectedDevice] async

List currently connected adb devices, as reported by adb devices -l.

Returns:

Type Description
list[ConnectedDevice]

One entry per connected device, in whatever state adb currently reports (including unauthorized or offline devices). Empty list if none are connected.

Example

Called with no arguments. A typical response:

{
  "status": "success",
  "message": "list_connected_devices completed successfully.",
  "data": [
    {"serial": "emulator-5554", "state": "device", "model": "Pixel", "product": "redfin"}
  ],
  "error": null
}
Source code in src/adb_automation_mcp/modules/device_info/tools.py
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
@category("read")
async def list_connected_devices(ctx: Context) -> list[ConnectedDevice]:
    """List currently connected adb devices, as reported by `adb devices -l`.

    Returns:
        One entry per connected device, in whatever state adb currently reports
        (including unauthorized or offline devices). Empty list if none are
        connected.

    Example:
        Called with no arguments. A typical response:

        ```json
        {
          "status": "success",
          "message": "list_connected_devices completed successfully.",
          "data": [
            {"serial": "emulator-5554", "state": "device", "model": "Pixel", "product": "redfin"}
          ],
          "error": null
        }
        ```
    """
    services = cast("dict[str, object]", ctx.lifespan_context["services"])
    device_info = cast(DeviceInfoService, services["device_info"])
    return await device_info.list_devices()