mobile_press_button
Press buttons on mobile devices to navigate interfaces, control volume, or execute commands during automated testing or interaction workflows.
Instructions
Press a button on device
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| device | Yes | The device identifier to use. Use mobile_list_available_devices to find which devices are available to you. | |
| button | Yes | 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) |
Implementation Reference
- src/server.ts:320-324 (handler)The handler function for the mobile_press_button tool. It requires a device/robot to be selected and calls the pressButton method on it with the provided button argument.async ({ button }) => { requireRobot(); await robot!.pressButton(button); return `Pressed the button: ${button}`; }
- src/server.ts:317-319 (schema)Zod input schema for the tool, defining the 'button' parameter as a string with description of supported buttons.{ 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)"), },
- src/server.ts:314-325 (registration)Registration of the mobile_press_button tool using the custom tool() helper function, which internally registers it with the MCP server.tool( "mobile_press_button", "Press a button on device", { 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 ({ button }) => { requireRobot(); await robot!.pressButton(button); return `Pressed the button: ${button}`; } );