Skip to main content
Glama

rotate

Change the screen orientation of a device to portrait or landscape for mobile app testing.

Instructions

Change l'orientation de l'écran du device (portrait ou landscape).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
orientationYesOrientation souhaitée

Implementation Reference

  • src/index.ts:59-59 (registration)
    Registration of the rotate tool via registerRotate(server) on the MCP server
    registerRotate(server);
  • Main handler for the 'rotate' tool. Takes an 'orientation' parameter (portrait|landscape), resolves the device, uses AppleScript key codes for iOS Simulator (Cmd+Left/Right) or calls androidRotate for Android.
    export function registerRotate(server: McpServer): void {
      server.tool(
        "rotate",
        "Change l'orientation de l'écran du device (portrait ou landscape).",
        {
          orientation: z.enum(["portrait", "landscape"]).describe("Orientation souhaitée"),
        },
        async ({ orientation }) => {
          const result = await resolveDevice();
          if ("error" in result) return { content: [{ type: "text", text: result.error }], isError: true };
          const dev = result.device;
    
          try {
            if (dev.platform === "ios") {
              // Simulator shortcuts: Cmd+Left = rotate left, Cmd+Right = rotate right
              await execFileAsync("osascript", ["-e",
                'tell application "Simulator" to activate',
              ]);
              await new Promise((r) => setTimeout(r, 300));
    
              // Landscape = Cmd+Right (keycode 124), Portrait = Cmd+Left (keycode 123)
              const keyCode = orientation === "landscape" ? 124 : 123;
              await execFileAsync("osascript", ["-e",
                `tell application "System Events" to key code ${keyCode} using {command down}`,
              ]);
            } else {
              await androidRotate(orientation);
            }
    
            logAction("rotate", `Écran tourné en ${orientation}`, false, dev.platform, dev.id, dev.name);
            return { content: [{ type: "text", text: `Écran tourné en ${orientation}.` }] };
          } catch (err) {
            const msg = err instanceof Error ? err.message : String(err);
            return { content: [{ type: "text", text: `Erreur rotate: ${msg}` }], isError: true };
          }
        }
      );
    }
  • Schema definition for the rotate tool using zod: orientation is a z.enum(['portrait', 'landscape'])
    {
      orientation: z.enum(["portrait", "landscape"]).describe("Orientation souhaitée"),
    },
  • Android helper that disables auto-rotate via adb shell settings and sets user_rotation to 0 (portrait) or 1 (landscape)
    export async function androidRotate(orientation: "portrait" | "landscape"): Promise<void> {
      // Disable auto-rotate first
      await adb(["shell", "settings", "put", "system", "accelerometer_rotation", "0"]);
      // 0 = portrait, 1 = landscape
      const value = orientation === "landscape" ? "1" : "0";
      await adb(["shell", "settings", "put", "system", "user_rotation", value]);
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are present, so the description must disclose behavioral traits. It only states that the orientation changes, but fails to mention any side effects, failure modes, or device requirements (e.g., unlocked state). This is insufficient disclosure for a mutating operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, well-structured sentence that front-loads the action and immediately specifies the two possible values. Every word is necessary and no extraneous information is present.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple with one parameter and no output schema. The description adequately covers purpose and parameter values. However, it lacks any mention of return behavior or confirmation, which is a minor gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with one parameter fully described (enum values, description). The tool description adds no extra meaning beyond what the schema already provides, meriting the baseline score of 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Change l'orientation') and the resource ('écran du device') with the two possible values explicitly listed in parentheses. It is distinct from sibling tools like 'tap' or 'swipe' which perform different actions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives, prerequisites, or context. The description only states what the tool does, leaving the agent to infer usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/nthImpulse/phantom-mcp'

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