type_text
Type text on Android devices to automate input tasks. Handles spaces correctly for reliable text entry.
Instructions
Type text on the connected Android device. Handles spaces correctly.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes |
Implementation Reference
- src/espresso_mcp/server.py:251-263 (handler)The handler function for the 'type_text' tool. It types text on an Android device using ADB by replacing spaces with %s and executing 'adb shell input text'.@mcp.tool() def type_text(text: str) -> str: """Type text on the connected Android device. Handles spaces correctly.""" # Replace spaces with %s for adb input adb_text = text.replace(" ", "%s") result = subprocess.run( ["adb", "shell", "input", "text", adb_text], capture_output=True, text=True, ) if result.returncode != 0: raise RuntimeError(f"Error typing text '{text}': {result.stderr}") return f"Text '{text}' has been typed successfully."