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

Function resumeExecution

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

Source from the content-addressed store, hash-verified

1359 );
1360
1361 const resumeExecution = (
1362 executionId: string,
1363 action: "accept" | "decline" | "cancel",
1364 content: Record<string, unknown> | undefined,
1365 extra: McpRequestJoinKeys,
1366 ): Effect.Effect<McpToolResult, E> =>
1367 Effect.gen(function* () {
1368 yield* startMarker("mcp.host.tool.resume.start", {
1369 "mcp.tool.name": "resume",
1370 "mcp.execute.execution_id": executionId,
1371 });
1372 debugLog("resume.call", {
1373 executionId,
1374 action,
1375 hasContent: content !== undefined,
1376 clientCapabilities: server.server.getClientCapabilities() ?? null,
1377 });
1378 const outcome = yield* resumeWithLifecycle(executionId, { action, content });
1379 if (!outcome) {
1380 debugLog("resume.missing_execution", { executionId });
1381 if (yield* localExecutionAlreadySettled(executionId)) {
1382 return alreadySettledResult(executionId);
1383 }
1384 const fallback = yield* resumeFallback(executionId, { action, content });
1385 if (fallback) {
1386 debugLog("resume.fallback_result", { executionId, status: fallback.status });
1387 return fallbackOutcomeResult(executionId, fallback);
1388 }
1389 return missingExecutionResult(executionId);
1390 }
1391 debugLog("resume.result", {
1392 executionId,
1393 status: outcome.status,
1394 nextExecutionId: outcome.status === "paused" ? outcome.execution.id : undefined,
1395 interactionKind:
1396 outcome.status === "paused"
1397 ? pausedInteractionKind(outcome.execution.elicitationContext.request)
1398 : undefined,
1399 });
1400 if (outcome.status === "paused") {
1401 return yield* formatPausedModelResult(outcome.execution, "resume");
1402 }
1403 return toMcpResult(outcome.result);
1404 }).pipe(
1405 Effect.withSpan("mcp.host.tool.resume", {
1406 attributes: {
1407 "mcp.tool.name": "resume",
1408 "mcp.execute.resume.action": action,
1409 "mcp.execute.execution_id": executionId,
1410 },
1411 }),
1412 Effect.annotateSpans(joinKeyAttributes(extra)),
1413 );
1414
1415 const requireUserResumeApproval = (executionId: string): Effect.Effect<McpToolResult> =>
1416 Effect.sync(() => {

Callers 1

createExecutorMcpServerFunction · 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
joinKeyAttributesFunction · 0.85

Tested by

no test coverage detected