Skip to main content
Glama
rahulkr
by rahulkr

get_device_info

Retrieve comprehensive Android device details including model, OS version, and hardware specifications for development, testing, and debugging workflows.

Instructions

Get comprehensive device information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
device_serialNo

Implementation Reference

  • Handler function for 'get_device_info' tool. Fetches device properties (model, manufacturer, Android version, screen info, battery status) using ADB shell getprop, wm, and dumpsys battery commands. Returns a dictionary with the information.
    @mcp.tool()
    def get_device_info(device_serial: str | None = None) -> dict:
        """Get comprehensive device information"""
        props = [
            ("model", "ro.product.model"),
            ("manufacturer", "ro.product.manufacturer"),
            ("device", "ro.product.device"),
            ("android_version", "ro.build.version.release"),
            ("sdk_version", "ro.build.version.sdk"),
            ("build_id", "ro.build.id"),
            ("hardware", "ro.hardware"),
            ("serial", "ro.serialno"),
            ("locale", "persist.sys.locale"),
            ("timezone", "persist.sys.timezone"),
        ]
        
        info = {}
        for name, prop in props:
            info[name] = run_adb(["shell", "getprop", prop], device_serial).strip()
        
        # Add screen info
        info["screen_size"] = run_adb(["shell", "wm", "size"], device_serial).strip()
        info["screen_density"] = run_adb(["shell", "wm", "density"], device_serial).strip()
        
        # Battery info
        battery = run_adb(["shell", "dumpsys", "battery"], device_serial)
        for line in battery.split('\n'):
            if 'level:' in line:
                info["battery_level"] = line.split(':')[1].strip() + "%"
            if 'status:' in line:
                status_map = {'2': 'Charging', '3': 'Discharging', '4': 'Not charging', '5': 'Full'}
                status = line.split(':')[1].strip()
                info["battery_status"] = status_map.get(status, status)
        
        return info
  • Registers the get_device_info function as an MCP tool using the FastMCP decorator.
    @mcp.tool()
  • Utility function used by get_device_info to execute ADB commands and handle output/errors.
    def run_adb(args: list[str], device_serial: str | None = None, timeout: int = 30) -> str:
        """Run an ADB command and return output"""
        cmd = ["adb"]
        if device_serial:
            cmd.extend(["-s", device_serial])
        cmd.extend(args)
        
        try:
            result = subprocess.run(cmd, capture_output=True, text=True, timeout=timeout)
            if result.returncode != 0 and result.stderr:
                return f"Error: {result.stderr}"
            return result.stdout
        except subprocess.TimeoutExpired:
            return "Error: Command timed out"
        except Exception as e:
            return f"Error: {str(e)}"
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It mentions 'comprehensive' but doesn't disclose what information is returned, format, permissions needed, or potential side effects. For a tool with no annotation coverage, this lacks essential behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words. It's appropriately sized for a simple tool, though it could be more informative without sacrificing brevity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no annotations, 0% schema coverage, no output schema, and many sibling tools fetching device data, the description is inadequate. It doesn't clarify scope, output, or differentiation, leaving significant gaps for an agent to use it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, and the description doesn't mention the 'device_serial' parameter at all. With one parameter undocumented in both schema and description, the description fails to compensate for the coverage gap, leaving parameter meaning unclear.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Get comprehensive device information' states the general purpose (verb+resource) but is vague about what 'comprehensive' entails. It doesn't differentiate from sibling tools like 'get_battery_stats', 'get_cpu_info', or 'get_memory_info' that retrieve specific device information subsets.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. With many sibling tools fetching specific device data (e.g., battery, CPU, memory), the description doesn't indicate whether this is a general-purpose tool or how it relates to them, leaving usage unclear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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

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