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

Function createStopMacAppExecutor

src/mcp/tools/macos/stop_mac_app.ts:53–88  ·  view source on GitHub ↗
(
  executor: CommandExecutor,
)

Source from the content-addressed store, hash-verified

51}
52
53export function createStopMacAppExecutor(
54 executor: CommandExecutor,
55): NonStreamingExecutor<StopMacAppParams, StopMacAppResult> {
56 return async (params) => {
57 const artifacts = createStopMacAppArtifacts(params);
58
59 if (!params.appName && params.processId === undefined) {
60 return buildStopFailure(artifacts, 'Either appName or processId must be provided.');
61 }
62
63 const target = params.processId ? `PID ${params.processId}` : params.appName!;
64 log('info', `Stopping macOS app: ${target}`);
65
66 try {
67 const command =
68 params.processId !== undefined
69 ? ['kill', String(params.processId)]
70 : ['pkill', '-f', params.appName!];
71 const result = await executor(command, 'Stop macOS App');
72
73 if (!result.success) {
74 return buildStopFailure(
75 artifacts,
76 `Stop macOS app operation failed: ${result.error ?? 'Unknown error'}`,
77 );
78 }
79
80 return buildStopSuccess(artifacts);
81 } catch (error) {
82 return buildStopFailure(
83 artifacts,
84 `Stop macOS app operation failed: ${toErrorMessage(error)}`,
85 );
86 }
87 };
88}
89
90export const schema = stopMacAppSchema.shape;
91

Callers 1

stop_mac_appLogicFunction · 0.85

Calls 6

buildStopFailureFunction · 0.90
logFunction · 0.90
buildStopSuccessFunction · 0.90
toErrorMessageFunction · 0.90
executorFunction · 0.50

Tested by

no test coverage detected