mobile_get_orientation
Retrieve the current screen orientation of a mobile device using the Mobile Next MCP server. Simplify mobile automation workflows by obtaining device orientation data for precise application interactions.
Instructions
Get the current screen orientation of the device
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| noParams | Yes |
Implementation Reference
- src/server.ts:464-475 (registration)Registration of the 'mobile_get_orientation' MCP tool. Includes the tool name, description, empty input schema (noParams), and handler function that requires a selected device (robot) and fetches the current orientation via robot.getOrientation().tool( "mobile_get_orientation", "Get the current screen orientation of the device", { noParams }, async () => { requireRobot(); const orientation = await robot!.getOrientation(); return `Current device orientation is ${orientation}`; } );
- src/android.ts:316-319 (handler)Concrete implementation of getOrientation in AndroidRobot class, which queries the device's user_rotation setting via adb and maps it to 'portrait' or 'landscape'.public async getOrientation(): Promise<Orientation> { const rotation = this.adb("shell", "settings", "get", "system", "user_rotation").toString().trim(); return rotation === "0" ? "portrait" : "landscape"; }
- src/ios.ts:194-197 (handler)Implementation of getOrientation in IosRobot class, delegating to the WebDriverAgent (WDA).public async getOrientation(): Promise<Orientation> { const wda = await this.wda(); return await wda.getOrientation(); }
- src/robot.ts:122-122 (helper)Interface definition for Robot.getOrientation method, used by the tool handler.getOrientation(): Promise<Orientation>;
- src/server.ts:467-469 (schema)Input schema for the tool: empty object (no parameters required). noParams is z.object({}).{ noParams },