Skip to main content
Glama
mobile-next

Mobile Next MCP Server

Official
by mobile-next

Press Button

mobile_press_button
Destructive

Press hardware or navigation buttons on mobile devices to control volume, navigate interfaces, or trigger actions during automated testing and interaction workflows.

Instructions

Press a button on device

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deviceYesThe device identifier to use. Use mobile_list_available_devices to find which devices are available to you.
buttonYesThe button to press. Supported buttons: BACK (android only), HOME, VOLUME_UP, VOLUME_DOWN, ENTER, DPAD_CENTER (android tv only), DPAD_UP (android tv only), DPAD_DOWN (android tv only), DPAD_LEFT (android tv only), DPAD_RIGHT (android tv only)

Implementation Reference

  • src/server.ts:426-439 (registration)
    MCP tool registration for 'mobile_press_button', including Zod input schema (device, button) and execution handler that delegates to Robot.pressButton(button).
    tool(
    	"mobile_press_button",
    	"Press Button",
    	"Press a button on device",
    	{
    		device: z.string().describe("The device identifier to use. Use mobile_list_available_devices to find which devices are available to you."),
    		button: z.string().describe("The button to press. Supported buttons: BACK (android only), HOME, VOLUME_UP, VOLUME_DOWN, ENTER, DPAD_CENTER (android tv only), DPAD_UP (android tv only), DPAD_DOWN (android tv only), DPAD_LEFT (android tv only), DPAD_RIGHT (android tv only)"),
    	},
    	async ({ device, button }) => {
    		const robot = getRobotFromDevice(device);
    		await robot.pressButton(button);
    		return `Pressed the button: ${button}`;
    	}
    );
  • Core handler logic for the MCP tool: retrieves Robot instance via getRobotFromDevice and invokes pressButton on it.
    async ({ device, button }) => {
    	const robot = getRobotFromDevice(device);
    	await robot.pressButton(button);
    	return `Pressed the button: ${button}`;
    }
  • AndroidRobot implementation of pressButton: maps button to ADB keyevent code and executes via adb shell.
    public async pressButton(button: Button) {
    	if (!BUTTON_MAP[button]) {
    		throw new ActionableError(`Button "${button}" is not supported`);
    	}
    
    	const mapped = BUTTON_MAP[button];
    	this.adb("shell", "input", "keyevent", mapped);
    }
  • IosRobot implementation of pressButton: delegates to WebDriverAgent (WDA).
    public async pressButton(button: Button): Promise<void> {
    	const wda = await this.wda();
    	await wda.pressButton(button);
    }
  • MobileDevice implementation of pressButton: delegates to mobilecli via runCommand.
    public async pressButton(button: Button): Promise<void> {
    	this.runCommand(["io", "button", button]);
    }
Behavior3/5

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

The annotations provide destructiveHint=true, indicating this performs a potentially destructive action. The description adds minimal context beyond this - it confirms the action is a 'press' operation but doesn't elaborate on what 'destructive' means in this context (e.g., could interrupt current operations, cause state changes, or have side effects). No rate limits, authentication needs, or specific behavioral traits are mentioned.

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 extremely concise at just 5 words, front-loading the core action without any unnecessary elaboration. Every word earns its place, making it easy for an agent to quickly understand the tool's purpose.

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

Completeness3/5

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

For a destructive operation with 2 parameters and no output schema, the description is minimally complete. It states what the tool does but lacks context about consequences, error conditions, or what constitutes success. The annotations cover the destructive nature, but more behavioral context would be helpful given the tool's potential impact.

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 already documents both parameters thoroughly. The description adds no additional parameter information beyond what's in the schema. The baseline score of 3 is appropriate since the schema carries the full parameter documentation burden.

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 ('Press') and target ('a button on device'), providing a specific verb+resource combination. It doesn't explicitly differentiate from sibling tools like mobile_click_on_screen_at_coordinates or mobile_double_tap_on_screen, but the focus on physical buttons rather than screen interactions provides implicit differentiation.

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?

The description provides no guidance on when to use this tool versus alternatives. While the input schema mentions using mobile_list_available_devices to find devices, there's no mention of when to press buttons versus other interaction methods, what scenarios require button presses, or any prerequisites beyond device availability.

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/mobile-next/mobile-mcp'

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