MCPcopy Index your code
hub / github.com/simstudioai/sim / waitForToolCompletion

Function waitForToolCompletion

apps/sim/lib/copilot/request/tools/client.ts:17–33  ·  view source on GitHub ↗
(
  toolCallId: string,
  timeoutMs: number,
  abortSignal?: AbortSignal
)

Source from the content-addressed store, hash-verified

15 * waiting for a foreground result
16 */
17export async function waitForToolCompletion(
18 toolCallId: string,
19 timeoutMs: number,
20 abortSignal?: AbortSignal
21): Promise<AsyncTerminalCompletionSnapshot | null> {
22 const decision = await waitForToolConfirmation(toolCallId, timeoutMs, abortSignal, {
23 acceptStatus: (status) =>
24 status === MothershipStreamV1ToolOutcome.success ||
25 status === MothershipStreamV1ToolOutcome.error ||
26 status === ASYNC_TOOL_CONFIRMATION_STATUS.background ||
27 status === MothershipStreamV1ToolOutcome.cancelled,
28 })
29 if (decision && isAsyncTerminalConfirmationStatus(decision.status)) {
30 return { ...decision, status: decision.status }
31 }
32 return null
33}

Callers 1

dispatchToolExecutionFunction · 0.85

Calls 2

waitForToolConfirmationFunction · 0.90

Tested by

no test coverage detected