get_app_info
Retrieve detailed information about installed Android applications, including version, permissions, and activity data, for development and testing purposes.
Instructions
Get detailed information about an installed app
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| package_name | Yes | ||
| device_serial | No |
Implementation Reference
- src/adb_mcp_server/server.py:640-671 (handler)The main handler function for the 'get_app_info' tool. It is decorated with @mcp.tool(), which registers it as an MCP tool. The function extracts app information like version, install times, and target SDK from 'dumpsys package' output using regex.
@mcp.tool() def get_app_info(package_name: str, device_serial: str | None = None) -> dict: """Get detailed information about an installed app""" dump = run_adb(["shell", "dumpsys", "package", package_name], device_serial) info = {"package": package_name} # Extract version version_match = re.search(r'versionName=(\S+)', dump) if version_match: info['version_name'] = version_match.group(1) version_code_match = re.search(r'versionCode=(\d+)', dump) if version_code_match: info['version_code'] = version_code_match.group(1) # First install time install_match = re.search(r'firstInstallTime=(.+)', dump) if install_match: info['first_install'] = install_match.group(1).strip() # Last update time update_match = re.search(r'lastUpdateTime=(.+)', dump) if update_match: info['last_update'] = update_match.group(1).strip() # Target SDK sdk_match = re.search(r'targetSdk=(\d+)', dump) if sdk_match: info['target_sdk'] = sdk_match.group(1) return info