get_battery_stats
Retrieve detailed battery statistics from Android devices to monitor power consumption and health during development and testing workflows.
Instructions
Get detailed battery statistics
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| device_serial | No |
Implementation Reference
- src/adb_mcp_server/server.py:788-799 (handler)The main handler function for the 'get_battery_stats' tool. It executes 'adb shell dumpsys battery', parses the output into a dictionary of key-value pairs, and returns it. Registered via @mcp.tool() decorator.@mcp.tool() def get_battery_stats(device_serial: str | None = None) -> dict: """Get detailed battery statistics""" output = run_adb(["shell", "dumpsys", "battery"], device_serial) stats = {} for line in output.split('\n'): if ':' in line: key, value = line.split(':', 1) stats[key.strip()] = value.strip() return stats