mobile_set_orientation
Change the screen orientation of mobile devices to portrait or landscape for enhanced testing and automation workflows within the Mobile Next MCP Server environment.
Instructions
Change the screen orientation of the device
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| orientation | Yes | The desired orientation |
Implementation Reference
- src/server.ts:562-574 (handler)The primary handler for the 'mobile_set_orientation' tool. It resolves the device to a Robot instance and calls setOrientation(orientation) on it. Includes inline schema and registration via the 'tool' helper.tool( "mobile_set_orientation", "Change the screen orientation of the device", { device: z.string().describe("The device identifier to use. Use mobile_list_available_devices to find which devices are available to you."), orientation: z.enum(["portrait", "landscape"]).describe("The desired orientation"), }, async ({ device, orientation }) => { const robot = getRobotFromDevice(device); await robot.setOrientation(orientation); return `Changed device orientation to ${orientation}`; } );
- src/android.ts:452-458 (helper)AndroidRobot.setOrientation implementation using ADB commands to disable auto-rotation and set user_rotation.public async setOrientation(orientation: Orientation): Promise<void> { const value = orientation === "portrait" ? 0 : 1; // disable auto-rotation prior to setting the orientation this.adb("shell", "settings", "put", "system", "accelerometer_rotation", "0"); this.adb("shell", "content", "insert", "--uri", "content://settings/system", "--bind", "name:s:user_rotation", "--bind", `value:i:${value}`); }
- src/ios.ts:223-226 (helper)IosRobot.setOrientation delegates to WebDriverAgent (WDA).public async setOrientation(orientation: Orientation): Promise<void> { const wda = await this.wda(); await wda.setOrientation(orientation); }
- src/iphone-simulator.ts:274-277 (helper)Simctl.setOrientation (iOS Simulator) delegates to WebDriverAgent (WDA).public async setOrientation(orientation: Orientation): Promise<void> { const wda = await this.wda(); return wda.setOrientation(orientation); }