mobile_use_device
Select and configure a specific mobile device or simulator for testing and automation tasks. Supports Android, iOS, and simulator environments to streamline mobile application workflows.
Instructions
Select a device to use. This can be a simulator or an Android device. Use the list_available_devices tool to get a list of available devices.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| device | Yes | The name of the device to select | |
| deviceType | Yes | The type of device to select |
Implementation Reference
- src/server.ts:187-209 (registration)Registration of the 'mobile_use_device' tool including its description, Zod input schema (device and deviceType), and inline handler function that sets the current robot based on the device type by calling constructors or getting simulator.tool( "mobile_use_device", "Select a device to use. This can be a simulator or an Android device. Use the list_available_devices tool to get a list of available devices.", { device: z.string().describe("The name of the device to select"), deviceType: z.enum(["simulator", "ios", "android"]).describe("The type of device to select"), }, async ({ device, deviceType }) => { switch (deviceType) { case "simulator": robot = simulatorManager.getSimulator(device); break; case "ios": robot = new IosRobot(device); break; case "android": robot = new AndroidRobot(device); break; } return `Selected device: ${device}`; } );
- src/server.ts:194-208 (handler)The handler function executes the tool logic: switches on deviceType to create or get the appropriate Robot instance (Simctl for simulator, IosRobot, AndroidRobot) and assigns it to the global 'robot' variable.async ({ device, deviceType }) => { switch (deviceType) { case "simulator": robot = simulatorManager.getSimulator(device); break; case "ios": robot = new IosRobot(device); break; case "android": robot = new AndroidRobot(device); break; } return `Selected device: ${device}`; }
- src/server.ts:191-193 (schema)Zod schema defining the input parameters: 'device' (string) and 'deviceType' (enum: simulator, ios, android).device: z.string().describe("The name of the device to select"), deviceType: z.enum(["simulator", "ios", "android"]).describe("The type of device to select"), },