type_text
Simulate text input on connected Android devices via the espresso-mcp server. Ensures accurate handling of spaces and characters for reliable automation.
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' MCP tool. It uses ADB to input the provided text on the connected Android device, replacing spaces with '%s' to handle them correctly.@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."