MCPcopy Create free account
hub / github.com/getsentry/XcodeBuildMCP / isSimulatorData

Function isSimulatorData

src/mcp/tools/simulator/list_sims.ts:38–73  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

36export type SimulatorListResult = SimulatorListDomainResult;
37
38function isSimulatorData(value: unknown): value is SimulatorData {
39 if (!value || typeof value !== 'object') {
40 return false;
41 }
42
43 const obj = value as Record<string, unknown>;
44 if (!obj.devices || typeof obj.devices !== 'object') {
45 return false;
46 }
47
48 const devices = obj.devices as Record<string, unknown>;
49 for (const runtime in devices) {
50 const deviceList = devices[runtime];
51 if (!Array.isArray(deviceList)) {
52 return false;
53 }
54
55 for (const device of deviceList) {
56 if (!device || typeof device !== 'object') {
57 return false;
58 }
59
60 const deviceObj = device as Record<string, unknown>;
61 if (
62 typeof deviceObj.name !== 'string' ||
63 typeof deviceObj.udid !== 'string' ||
64 typeof deviceObj.state !== 'string' ||
65 typeof deviceObj.isAvailable !== 'boolean'
66 ) {
67 return false;
68 }
69 }
70 }
71
72 return true;
73}
74
75export async function listSimulators(
76 executor: CommandExecutor,

Callers 1

listSimulatorsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected