clear_text_field
Remove text from Android device input fields by sending delete key commands. This tool helps clear text boxes during UI testing and development workflows.
Instructions
Clear text in current field by sending delete keys
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| length | No | ||
| device_serial | No |
Implementation Reference
- src/adb_mcp_server/server.py:506-513 (handler)The clear_text_field tool handler: moves cursor to end of field and sends multiple delete keyevents to clear up to the specified number of characters. Registered via @mcp.tool() decorator.@mcp.tool() def clear_text_field(length: int = 50, device_serial: str | None = None) -> str: """Clear text in current field by sending delete keys""" # Move to end and delete backwards run_adb(["shell", "input", "keyevent", "KEYCODE_MOVE_END"], device_serial) for _ in range(length): run_adb(["shell", "input", "keyevent", "KEYCODE_DEL"], device_serial) return f"Cleared up to {length} characters"