rotate_screen
Change Android device screen orientation for testing and development. Supports portrait, landscape, reverse orientations, and auto-rotation modes.
Instructions
Rotate screen orientation.
orientation: 'portrait', 'landscape', 'reverse_portrait', 'reverse_landscape', or 'auto'
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| orientation | No | portrait | |
| device_serial | No |
Implementation Reference
- src/adb_mcp_server/server.py:903-928 (handler)The rotate_screen tool implementation. Decorated with @mcp.tool() for MCP registration. Handles screen rotation by setting ADB system settings for accelerometer_rotation and user_rotation based on the specified orientation.@mcp.tool() def rotate_screen(orientation: str = "portrait", device_serial: str | None = None) -> str: """ Rotate screen orientation. orientation: 'portrait', 'landscape', 'reverse_portrait', 'reverse_landscape', or 'auto' """ orientations = { 'auto': ('0', 'user'), 'portrait': ('1', '0'), 'landscape': ('1', '1'), 'reverse_portrait': ('1', '2'), 'reverse_landscape': ('1', '3') } if orientation not in orientations: return f"Invalid orientation. Use: {list(orientations.keys())}" accel_rotation, user_rotation = orientations[orientation] if orientation == 'auto': run_adb(["shell", "settings", "put", "system", "accelerometer_rotation", "1"], device_serial) else: run_adb(["shell", "settings", "put", "system", "accelerometer_rotation", "0"], device_serial) run_adb(["shell", "settings", "put", "system", "user_rotation", user_rotation], device_serial) return f"Screen rotation set to {orientation}"