MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / resumeExecution

Function resumeExecution

packages/hosts/mcp/src/tool-server-core.ts:1340–1392  ·  view source on GitHub ↗
(
      executionId: string,
      action: "accept" | "decline" | "cancel",
      content: Record<string, unknown> | undefined,
      extra: RequestContext,
    )

Source from the content-addressed store, hash-verified

1338 );
1339
1340 const resumeExecution = (
1341 executionId: string,
1342 action: "accept" | "decline" | "cancel",
1343 content: Record<string, unknown> | undefined,
1344 extra: RequestContext,
1345 ): Effect.Effect<McpToolResult, E> =>
1346 Effect.gen(function* () {
1347 yield* startMarker("mcp.host.tool.resume.start", {
1348 "mcp.tool.name": "resume",
1349 "mcp.execute.execution_id": executionId,
1350 });
1351 debugLog("resume.call", {
1352 executionId,
1353 action,
1354 hasContent: content !== undefined,
1355 clientCapabilities: assembly.getClientCapabilities(),
1356 });
1357 const outcome = yield* resumeWithLifecycle(executionId, { action, content });
1358 if (!outcome) {
1359 debugLog("resume.missing_execution", { executionId });
1360 if (yield* localExecutionAlreadySettled(executionId)) {
1361 return alreadySettledResult(executionId);
1362 }
1363 const fallback = yield* resumeFallback(executionId, { action, content });
1364 if (fallback) {
1365 debugLog("resume.fallback_result", { executionId, status: fallback.status });
1366 return fallbackOutcomeResult(executionId, fallback);
1367 }
1368 return missingExecutionResult(executionId);
1369 }
1370 debugLog("resume.result", {
1371 executionId,
1372 status: outcome.status,
1373 nextExecutionId: outcome.status === "paused" ? outcome.execution.id : undefined,
1374 interactionKind:
1375 outcome.status === "paused"
1376 ? pausedInteractionKind(outcome.execution.elicitationContext.request)
1377 : undefined,
1378 });
1379 if (outcome.status === "paused") {
1380 return yield* formatPausedModelResult(outcome.execution, "resume");
1381 }
1382 return toMcpResult(outcome.result);
1383 }).pipe(
1384 Effect.withSpan("mcp.host.tool.resume", {
1385 attributes: {
1386 "mcp.tool.name": "resume",
1387 "mcp.execute.resume.action": action,
1388 "mcp.execute.execution_id": executionId,
1389 },
1390 }),
1391 Effect.annotateSpans(requestSpanAttributes(extra)),
1392 );
1393
1394 const requireUserResumeApproval = (executionId: string): Effect.Effect<McpToolResult> =>
1395 Effect.sync(() => {

Callers 1

buildExecutorMcpToolsFunction · 0.85

Calls 12

startMarkerFunction · 0.85
debugLogFunction · 0.85
resumeWithLifecycleFunction · 0.85
alreadySettledResultFunction · 0.85
resumeFallbackFunction · 0.85
fallbackOutcomeResultFunction · 0.85
missingExecutionResultFunction · 0.85
pausedInteractionKindFunction · 0.85
formatPausedModelResultFunction · 0.85
toMcpResultFunction · 0.85
requestSpanAttributesFunction · 0.85

Tested by

no test coverage detected