mobile_launch_app
Launch Android applications by specifying their package name to open apps directly on connected devices for testing and automation purposes.
Instructions
Launch an application by its package name.
Args: package_name: The package name of the app to launch (e.g., 'com.android.chrome')
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| package_name | Yes |
Input Schema (JSON Schema)
{
"properties": {
"package_name": {
"type": "string"
}
},
"required": [
"package_name"
],
"type": "object"
}
Implementation Reference
- main.py:252-268 (handler)The handler function for the 'mobile_launch_app' tool, decorated with @mcp.tool() for registration. It launches an Android app by package name using the global 'device' object, after checking if the device is initialized and if the app is installed.def mobile_launch_app(package_name: str) -> str: """Launch an application by its package name. Args: package_name: The package name of the app to launch (e.g., 'com.android.chrome') """ 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() if package_name not in apps: return f"App {package_name} is not in the list of installed apps. Please use mobile_list_apps to get the current app list." device.app_start(package_name) return f"Successfully launched app: {package_name}" except Exception as e: return f"Error launching app {package_name}: {str(e)}"