mobile_list_apps
Retrieve a complete list of installed applications on Android devices with package names and app labels for device management and automation tasks.
Instructions
List all installed applications on the Android device.
Returns a JSON array with package names and application labels.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- main.py:236-249 (handler)Handler function for the 'mobile_list_apps' tool. Decorated with @mcp.tool() which registers it with the MCP server. Retrieves list of installed apps via uiautomator2, filters launchable ones using helper functions, and returns as JSON.@mcp.tool() def mobile_list_apps() -> str: """List all installed applications on the Android device. Returns a JSON array with package names and application labels. """ if device is None: return "Error: Device not initialized. Please call mobile_init() first to establish connection with Android device." try: apps = device.app_list() launchable_apps = [pkg for pkg in apps if is_launchable_app(pkg)] return json.dumps(launchable_apps, ensure_ascii=False, indent=2) except Exception as e: return f"Error listing apps: {str(e)}"
- main.py:225-234 (helper)Helper function used by mobile_list_apps to determine if an app package is launchable (non-system and has resolve-activity).def is_launchable_app(package): if is_system_app(package): return False try: response = device.shell(f"cmd package resolve-activity --brief {package}") output = response.output return "/" in output except Exception: return False
- main.py:209-223 (helper)Helper function to identify and exclude system apps via regex patterns, used by is_launchable_app.def is_system_app(package): exclude_patterns = [ r"^com\.android\.systemui", r"^com\.android\.providers\.", r"^com\.android\.internal\.", r"^com\.android\.cellbroadcast", r"^com\.android\.phone", r"^com\.android\.bluetooth", r"^com\.google\.android\.overlay", r"^com\.google\.mainline", r"^com\.google\.android\.ext", r"\.auto_generated_rro_", r"^android$", ] return any(re.search(p, package) for p in exclude_patterns)