Skip to main content
Glama
mobile-next

Mobile Next MCP Server

Official
by mobile-next

mobile_type_keys

Automate text input on mobile devices by typing into focused elements, with an option to simulate pressing the enter key for submission. Ideal for iOS and Android app interactions.

Instructions

Type text into the focused element

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
submitYesWhether to submit the text. If true, the text will be submitted as if the user pressed the enter key.
textYesThe text to type

Implementation Reference

  • Handler function that retrieves the appropriate Robot instance for the device and invokes sendKeys(text) to type the text, optionally pressing ENTER if submit is true.
    async ({ device, text, submit }) => { const robot = getRobotFromDevice(device); await robot.sendKeys(text); if (submit) { await robot.pressButton("ENTER"); } return `Typed text: ${text}`; }
  • Zod schema defining input parameters: device (string), text (string), submit (boolean).
    { device: z.string().describe("The device identifier to use. Use mobile_list_available_devices to find which devices are available to you."), text: z.string().describe("The text to type"), submit: z.boolean().describe("Whether to submit the text. If true, the text will be submitted as if the user pressed the enter key."), },
  • src/server.ts:468-486 (registration)
    Registers the mobile_type_keys MCP tool with the server using the custom tool() wrapper, including description, input schema, and handler function.
    tool( "mobile_type_keys", "Type text into the focused element", { device: z.string().describe("The device identifier to use. Use mobile_list_available_devices to find which devices are available to you."), text: z.string().describe("The text to type"), submit: z.boolean().describe("Whether to submit the text. If true, the text will be submitted as if the user pressed the enter key."), }, async ({ device, text, submit }) => { const robot = getRobotFromDevice(device); await robot.sendKeys(text); if (submit) { await robot.pressButton("ENTER"); } return `Typed text: ${text}`; } );
  • Helper function to get the appropriate Robot instance (AndroidRobot, IosRobot, or Simulator) based on the device identifier.
    const getRobotFromDevice = (device: string): Robot => { const iosManager = new IosManager(); const androidManager = new AndroidDeviceManager(); const simulators = simulatorManager.listBootedSimulators(); const androidDevices = androidManager.getConnectedDevices(); const iosDevices = iosManager.listDevices(); // Check if it's a simulator const simulator = simulators.find(s => s.name === device); if (simulator) { return simulatorManager.getSimulator(device); } // Check if it's an Android device const androidDevice = androidDevices.find(d => d.deviceId === device); if (androidDevice) { return new AndroidRobot(device); } // Check if it's an iOS device const iosDevice = iosDevices.find(d => d.deviceId === device); if (iosDevice) { return new IosRobot(device); } throw new ActionableError(`Device "${device}" not found. Use the mobile_list_available_devices tool to see available devices.`);

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