Skip to main content
Glama
mobile-next

Mobile Next MCP Server

Official
by mobile-next

mobile_press_button

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]); }

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