Skip to main content
Glama
rahulkr
by rahulkr

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
NameRequiredDescriptionDefault
device_serialNo

Implementation Reference

  • 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

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/rahulkr/r_adb_mcp_server'

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