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

Function resumeExecution

packages/hosts/mcp/src/tool-server.ts:1327–1379  ·  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

1325 );
1326
1327 const resumeExecution = (
1328 executionId: string,
1329 action: "accept" | "decline" | "cancel",
1330 content: Record<string, unknown> | undefined,
1331 extra: McpRequestJoinKeys,
1332 ): Effect.Effect<McpToolResult, E> =>
1333 Effect.gen(function* () {
1334 yield* startMarker("mcp.host.tool.resume.start", {
1335 "mcp.tool.name": "resume",
1336 "mcp.execute.execution_id": executionId,
1337 });
1338 debugLog("resume.call", {
1339 executionId,
1340 action,
1341 hasContent: content !== undefined,
1342 clientCapabilities: server.server.getClientCapabilities() ?? null,
1343 });
1344 const outcome = yield* resumeWithLifecycle(executionId, { action, content });
1345 if (!outcome) {
1346 debugLog("resume.missing_execution", { executionId });
1347 if (yield* localExecutionAlreadySettled(executionId)) {
1348 return alreadySettledResult(executionId);
1349 }
1350 const fallback = yield* resumeFallback(executionId, { action, content });
1351 if (fallback) {
1352 debugLog("resume.fallback_result", { executionId, status: fallback.status });
1353 return fallbackOutcomeResult(executionId, fallback);
1354 }
1355 return missingExecutionResult(executionId);
1356 }
1357 debugLog("resume.result", {
1358 executionId,
1359 status: outcome.status,
1360 nextExecutionId: outcome.status === "paused" ? outcome.execution.id : undefined,
1361 interactionKind:
1362 outcome.status === "paused"
1363 ? pausedInteractionKind(outcome.execution.elicitationContext.request)
1364 : undefined,
1365 });
1366 if (outcome.status === "paused") {
1367 return yield* formatPausedModelResult(outcome.execution, "resume");
1368 }
1369 return toMcpResult(outcome.result);
1370 }).pipe(
1371 Effect.withSpan("mcp.host.tool.resume", {
1372 attributes: {
1373 "mcp.tool.name": "resume",
1374 "mcp.execute.resume.action": action,
1375 "mcp.execute.execution_id": executionId,
1376 },
1377 }),
1378 Effect.annotateSpans(joinKeyAttributes(extra)),
1379 );
1380
1381 const requireUserResumeApproval = (executionId: string): Effect.Effect<McpToolResult> =>
1382 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