mobile_click
Click on specific screen coordinates to interact with Android device interfaces. Perform precise touch actions by providing X and Y coordinates for targeted UI elements.
Instructions
Click on a specific coordinate on the Android screen.
Args: x: X coordinate to click y: Y coordinate to click
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | ||
| y | Yes |
Input Schema (JSON Schema)
{
"properties": {
"x": {
"type": "integer"
},
"y": {
"type": "integer"
}
},
"required": [
"x",
"y"
],
"type": "object"
}
Implementation Reference
- main.py:124-143 (handler)The main handler function for the 'mobile_click' tool. It is registered via the @mcp.tool() decorator. Validates device initialization and UI coordinates before performing a click at the specified (x, y) using uiautomator2's device.click method.@mcp.tool() def mobile_click(x: int, y: int) -> str: """Click on a specific coordinate on the Android screen. Args: x: X coordinate to click y: Y coordinate to click """ if device is None: return "Error: Device not initialized. Please call mobile_init() first to establish connection with Android device." try: _mobile_dump_ui() global ui_coords if (x, y) not in ui_coords: return "Invalid elements coordinates. Please use mobile_dump_ui to get the latest UI state first." device.click(x, y) return f"Successfully clicked on coordinate ({x}, {y})" except Exception as e: return f"Error clicking coordinate ({x}, {y}): {str(e)}"