mobile_list_available_devices
Retrieve and display all available devices, including physical devices and simulators, for mobile automation. Facilitates user selection when multiple devices are identified.
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 all available devices including iOS simulators, physical iOS devices, Android mobile devices, and Android TV devices by querying the respective device managers.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 for 'mobile_list_available_devices' using the internal 'tool' wrapper function, specifying name, description, empty input schema (noParams), and inline handler.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 for tools with no input parameters, including mobile_list_available_devices.const noParams = z.object({});