mobile_type
Input text into Android text fields for automated testing and interaction, supporting submission with Enter key press.
Instructions
Input text into the currently focused text field on Android.
Args: text: The text to input submit: Whether to submit text (press Enter key) after typing
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | ||
| submit | No |
Implementation Reference
- main.py:145-162 (handler)The main handler function for the 'mobile_type' tool. It is registered via the @mcp.tool() decorator and implements the logic to input text into the focused field on the Android device using uiautomator2's send_keys method, with an optional submit action.@mcp.tool() def mobile_type(text: str, submit: bool = False) -> str: """Input text into the currently focused text field on Android. Args: text: The text to input submit: Whether to submit text (press Enter key) after typing """ if device is None: return "Error: Device not initialized. Please call mobile_init() first to establish connection with Android device." try: device.send_keys(text) if submit: device.press("enter") return f"Successfully input text: {text} and pressed Enter" return f"Successfully input text: {text}" except Exception as e: return f"Error inputting text: {str(e)}"