mobile_list_available_devices
Lists available iOS and Android devices and simulators for mobile automation testing, enabling users to select a target device.
Instructions
List all available devices. This includes both physical devices and simulators. If there is more than one device returned, you need to let the user select one of them.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| noParams | Yes |
Implementation Reference
- src/server.ts:155-184 (handler)Handler function that lists available devices by querying iOS, Android managers and simulators, categorizing them into iOS simulators, iOS devices, Android mobile, Android TV, and formats a response string.async ({}) => { const iosManager = new IosManager(); const androidManager = new AndroidDeviceManager(); const simulators = simulatorManager.listBootedSimulators(); const simulatorNames = simulators.map(d => d.name); const androidDevices = androidManager.getConnectedDevices(); const iosDevices = await iosManager.listDevices(); const iosDeviceNames = iosDevices.map(d => d.deviceId); const androidTvDevices = androidDevices.filter(d => d.deviceType === "tv").map(d => d.deviceId); const androidMobileDevices = androidDevices.filter(d => d.deviceType === "mobile").map(d => d.deviceId); const resp = ["Found these devices:"]; if (simulatorNames.length > 0) { resp.push(`iOS simulators: [${simulatorNames.join(".")}]`); } if (iosDevices.length > 0) { resp.push(`iOS devices: [${iosDeviceNames.join(",")}]`); } if (androidMobileDevices.length > 0) { resp.push(`Android devices: [${androidMobileDevices.join(",")}]`); } if (androidTvDevices.length > 0) { resp.push(`Android TV devices: [${androidTvDevices.join(",")}]`); } return resp.join("\n"); }
- src/server.ts:149-185 (registration)Tool registration call that defines the name, description, empty input schema (noParams = z.object({})), and references the handler function.tool( "mobile_list_available_devices", "List all available devices. This includes both physical devices and simulators. If there is more than one device returned, you need to let the user select one of them.", { noParams }, async ({}) => { const iosManager = new IosManager(); const androidManager = new AndroidDeviceManager(); const simulators = simulatorManager.listBootedSimulators(); const simulatorNames = simulators.map(d => d.name); const androidDevices = androidManager.getConnectedDevices(); const iosDevices = await iosManager.listDevices(); const iosDeviceNames = iosDevices.map(d => d.deviceId); const androidTvDevices = androidDevices.filter(d => d.deviceType === "tv").map(d => d.deviceId); const androidMobileDevices = androidDevices.filter(d => d.deviceType === "mobile").map(d => d.deviceId); const resp = ["Found these devices:"]; if (simulatorNames.length > 0) { resp.push(`iOS simulators: [${simulatorNames.join(".")}]`); } if (iosDevices.length > 0) { resp.push(`iOS devices: [${iosDeviceNames.join(",")}]`); } if (androidMobileDevices.length > 0) { resp.push(`Android devices: [${androidMobileDevices.join(",")}]`); } if (androidTvDevices.length > 0) { resp.push(`Android TV devices: [${androidTvDevices.join(",")}]`); } return resp.join("\n"); } );
- src/server.ts:50-50 (schema)Shared empty schema object used as input parameters for tools with no arguments, including mobile_list_available_devices.const noParams = z.object({});