list_devices
Discover available Android emulators and iOS simulators for Tauri mobile app testing and development.
Instructions
[Tauri Mobile Apps Only] List Android emulators/devices and iOS simulators. Use for Tauri mobile development (tauri android dev, tauri ios dev). Not needed for desktop-only Tauri apps or web projects.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The inline handler for the 'list_devices' MCP tool. Calls the listDevices() function and formats the result into a human-readable string listing Android devices and iOS booted simulators.
handler: async () => { const devices = await listDevices(); return `Android Devices:\n${devices.android.join('\n') || 'None'}\n\niOS Booted Simulators:\n${devices.ios.join('\n') || 'None'}`; }, - The actual listDevices() async function that concurrently fetches Android devices (via adb) and iOS simulators (via xcrun simctl). Returns { android: string[], ios: string[] }.
export async function listDevices(): Promise<{ android: string[]; ios: string[] }> { const [ android, ios ] = await Promise.all([ getAndroidDevices(), getIOSSimulators(), ]); return { android, ios }; } - Zod schema for list_devices — an empty object (no input parameters required).
export const ListDevicesSchema = z.object({}); - packages/mcp-server/src/tools-registry.ts:133-152 (registration)Tool definition registration in the TOOLS array. Defines name 'list_devices', description, category (Mobile Development), schema, annotations, and handler.
// Mobile Development Tools { name: 'list_devices', description: '[Tauri Mobile Apps Only] List Android emulators/devices and iOS simulators. ' + 'Use for Tauri mobile development (tauri android dev, tauri ios dev). ' + 'Not needed for desktop-only Tauri apps or web projects.', category: TOOL_CATEGORIES.MOBILE_DEVELOPMENT, schema: ListDevicesSchema, annotations: { title: 'List Mobile Devices', readOnlyHint: true, openWorldHint: false, }, handler: async () => { const devices = await listDevices(); return `Android Devices:\n${devices.android.join('\n') || 'None'}\n\niOS Booted Simulators:\n${devices.ios.join('\n') || 'None'}`; }, }, - Helper function getAndroidDevices() that runs 'adb devices -l' and parses the output. Returns empty array if adb is not available.
async function getAndroidDevices(): Promise<string[]> { try { const { stdout } = await execa('adb', [ 'devices', '-l' ]); return stdout .split('\n') .slice(1) .filter((line) => { return line.trim().length > 0; }) .map((line) => { return line.trim(); }); } catch(_) { // Android SDK not available or adb command failed return []; } } - Helper function getIOSSimulators() that runs 'xcrun simctl list devices booted' on macOS only. Returns empty array on Windows/Linux or if xcrun fails.
async function getIOSSimulators(): Promise<string[]> { if (process.platform !== 'darwin') { return []; } try { const { stdout } = await execa('xcrun', [ 'simctl', 'list', 'devices', 'booted' ]); return stdout .split('\n') .filter((line) => { return line.trim().length > 0 && !line.includes('== Devices =='); }); } catch(_) { // Xcode not installed or xcrun command failed return []; } }