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

Function launch_app_simLogic

src/mcp/tools/simulator/launch_app_sim.ts:66–109  ·  view source on GitHub ↗
(
  params: LaunchAppSimParams,
  executor: CommandExecutor,
  launcher: SimulatorLauncher = launchSimulatorAppWithLogging,
)

Source from the content-addressed store, hash-verified

64export type SimulatorLauncher = typeof launchSimulatorAppWithLogging;
65
66export async function launch_app_simLogic(
67 params: LaunchAppSimParams,
68 executor: CommandExecutor,
69 launcher: SimulatorLauncher = launchSimulatorAppWithLogging,
70): Promise<void> {
71 const ctx = getHandlerContext();
72 const simulatorResult = await determineSimulatorUuid(params, executor);
73 if (simulatorResult.error || !simulatorResult.uuid) {
74 const result = buildLaunchFailure(
75 { bundleId: params.bundleId },
76 `Failed to resolve simulator: ${simulatorResult.error ?? 'No simulator UUID returned'}`,
77 { target: 'simulator' },
78 );
79 setLaunchResultStructuredOutput(ctx, result);
80 log('error', `Error during launch app in simulator operation: ${result.error}`);
81 return;
82 }
83
84 if (simulatorResult.warning) {
85 log('warn', simulatorResult.warning);
86 }
87
88 const resolvedParams: ResolvedLaunchAppSimParams = {
89 ...params,
90 simulatorId: simulatorResult.uuid,
91 };
92 const executeLaunchAppSim = createLaunchAppSimExecutor(executor, launcher);
93 const result = await executeLaunchAppSim(resolvedParams);
94
95 setLaunchResultStructuredOutput(ctx, result);
96
97 if (result.didError) {
98 log(
99 'error',
100 `Error during launch app in simulator operation: ${result.error ?? 'Unknown error'}`,
101 );
102 return;
103 }
104
105 ctx.nextStepParams = {
106 open_sim: {},
107 stop_app_sim: { simulatorId: resolvedParams.simulatorId, bundleId: params.bundleId },
108 };
109}
110
111function buildSuccessArtifacts(
112 params: ResolvedLaunchAppSimParams,

Callers 1

Calls 6

getHandlerContextFunction · 0.90
determineSimulatorUuidFunction · 0.90
buildLaunchFailureFunction · 0.90
logFunction · 0.90

Tested by

no test coverage detected