MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / fetchSimulatorDevices

Function fetchSimulatorDevices

src/utils/simulator-resolver.ts:10–28  ·  view source on GitHub ↗
(
  executor: CommandExecutor,
)

Source from the content-addressed store, hash-verified

8type SimulatorDevice = { udid: string; name: string };
9
10async function fetchSimulatorDevices(
11 executor: CommandExecutor,
12): Promise<{ devices: Record<string, SimulatorDevice[]> } | { error: string }> {
13 const result = await executor(
14 ['xcrun', 'simctl', 'list', 'devices', 'available', '--json'],
15 'List Simulators',
16 false,
17 );
18
19 if (!result.success) {
20 return { error: `Failed to list simulators: ${result.error}` };
21 }
22
23 try {
24 return JSON.parse(result.output) as { devices: Record<string, SimulatorDevice[]> };
25 } catch (parseError) {
26 return { error: `Failed to parse simulator list: ${parseError}` };
27 }
28}
29
30function findSimulator(
31 simulatorsData: { devices: Record<string, SimulatorDevice[]> },

Callers 2

resolveSimulatorNameToIdFunction · 0.85
resolveSimulatorIdToNameFunction · 0.85

Calls 1

executorFunction · 0.50

Tested by

no test coverage detected