Skip to main content
Glama
mobile.ts1.19 kB
import { z } from 'zod'; import { execa } from 'execa'; export const ListDevicesSchema = z.object({}); 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 []; } } 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 []; } } export async function listDevices(): Promise<{ android: string[]; ios: string[] }> { const [ android, ios ] = await Promise.all([ getAndroidDevices(), getIOSSimulators(), ]); return { android, ios }; }

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/hypothesi/mcp-server-tauri'

If you have feedback or need assistance with the MCP directory API, please join our Discord server