Skip to main content
Glama

mobile_get_orientation

Retrieve the current screen orientation of a mobile device for automation testing or UI adaptation, using the device identifier from available options.

Instructions

Get the current screen orientation of the device

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deviceYesThe device identifier to use. Use mobile_list_available_devices to find which devices are available to you.

Implementation Reference

  • src/server.ts:464-475 (registration)
    Registration of the 'mobile_get_orientation' MCP tool. The inline handler requires an active device/robot and delegates to its getOrientation() method, formatting the result as a string.
    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}`; } );
  • AndroidRobot implementation of getOrientation(): queries device settings via adb for user_rotation (0=portrait, else landscape).
    public async getOrientation(): Promise<Orientation> { const rotation = this.adb("shell", "settings", "get", "system", "user_rotation").toString().trim(); return rotation === "0" ? "portrait" : "landscape"; }
  • WebDriverAgent implementation of getOrientation() used by iOS devices and simulators: performs HTTP GET to /orientation endpoint within a WDA session and lowercases the result.
    public async getOrientation(): Promise<Orientation> { return this.withinSession(async sessionUrl => { const url = `${sessionUrl}/orientation`; const response = await fetch(url); const json = await response.json(); return json.value.toLowerCase() as Orientation; }); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/EmpathySlainLovers/MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server