Skip to main content
Glama

Set Orientation

mobile_set_orientation
Destructive

Change mobile device screen orientation between portrait and landscape modes for automated testing or accessibility adjustments.

Instructions

Change the 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.
orientationYesThe desired orientation

Implementation Reference

  • Handler function for the mobile_set_orientation tool. Ensures a device is selected via requireRobot() and delegates to the Robot instance's setOrientation method.
    async ({ orientation }) => {
    	requireRobot();
    	await robot!.setOrientation(orientation);
    	return `Changed device orientation to ${orientation}`;
    }
  • Zod input schema for the tool, defining 'orientation' as enum ['portrait', 'landscape'].
    orientation: z.enum(["portrait", "landscape"]).describe("The desired orientation"),
  • src/server.ts:451-462 (registration)
    Registration of the mobile_set_orientation tool on the MCP server using the 'tool' helper.
    tool(
    	"mobile_set_orientation",
    	"Change the screen orientation of the device",
    	{
    		orientation: z.enum(["portrait", "landscape"]).describe("The desired orientation"),
    	},
    	async ({ orientation }) => {
    		requireRobot();
    		await robot!.setOrientation(orientation);
    		return `Changed device orientation to ${orientation}`;
    	}
    );
  • Android-specific helper: AndroidRobot.setOrientation sets accelerometer_rotation to 0 and user_rotation to 0 (portrait) or 1 (landscape) via adb.
    public async setOrientation(orientation: Orientation): Promise<void> {
    	const orientationValue = 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:${orientationValue}`);
    }
  • iOS-specific helper: WebDriverAgent.setOrientation sends POST to /orientation endpoint with orientation in uppercase within a session.
    public async setOrientation(orientation: Orientation): Promise<void> {
    	await this.withinSession(async sessionUrl => {
    		const url = `${sessionUrl}/orientation`;
    		await fetch(url, {
    			method: "POST",
    			headers: { "Content-Type": "application/json" },
    			body: JSON.stringify({
    				orientation: orientation.toUpperCase()
    			})
    		});
    	});
    }
Behavior4/5

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

The description adds context beyond annotations: it indicates a change operation ('change the screen orientation'), which aligns with the destructiveHint: true annotation (implying a state-altering action). It doesn't contradict annotations, and while annotations cover the destructive nature, the description clarifies the specific behavioral effect (orientation change) without detailing side effects like screen refresh or app state impacts, which could be useful but aren't required for a good score.

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, direct sentence ('Change the screen orientation of the device') that front-loads the core action and resource without unnecessary words. It efficiently conveys the purpose without redundancy or fluff, making it easy for an agent to parse and apply quickly.

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?

Given the tool's moderate complexity (2 parameters, destructive operation), annotations provide safety context (destructiveHint: true), and schema covers parameters fully. The description adequately explains what the tool does, though it lacks output details (no output schema) and doesn't fully guide usage relative to siblings. For a state-changing tool with good schema support, this is reasonably complete but could benefit from more explicit sibling differentiation.

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?

With 100% schema description coverage, the schema fully documents both parameters (device and orientation with enum values). The description adds no additional parameter semantics beyond what's in the schema, such as explaining orientation effects or device requirements. This meets the baseline of 3, as the schema handles the heavy lifting, but the description doesn't compensate or enhance understanding further.

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

Purpose4/5

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

The description clearly states the action ('change') and target ('screen orientation of the device'), making the purpose immediately understandable. It distinguishes from siblings like mobile_get_orientation (which reads rather than sets) and mobile_list_available_devices (which lists devices). However, it doesn't explicitly mention the specific resource (device) beyond the general 'device', which slightly limits differentiation from tools like mobile_click_on_screen_at_coordinates that also target devices.

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

Usage Guidelines3/5

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

Usage is implied through the parameter descriptions in the schema (e.g., 'Use mobile_list_available_devices to find which devices are available'), but the description itself lacks explicit guidance on when to use this tool versus alternatives. It doesn't state prerequisites like needing a device identifier from mobile_list_available_devices or contrast with mobile_get_orientation for read operations, leaving the agent to infer context from the schema rather than the description.

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/EmpathySlainLovers/MCP'

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