(
executionId: string,
action: "accept" | "decline" | "cancel",
content: Record<string, unknown> | undefined,
)
| 683 | ); |
| 684 | |
| 685 | const resumeExecution = ( |
| 686 | executionId: string, |
| 687 | action: "accept" | "decline" | "cancel", |
| 688 | content: Record<string, unknown> | undefined, |
| 689 | ): Effect.Effect<McpToolResult, E> => |
| 690 | Effect.gen(function* () { |
| 691 | debugLog("resume.call", { |
| 692 | executionId, |
| 693 | action, |
| 694 | hasContent: content !== undefined, |
| 695 | clientCapabilities: server.server.getClientCapabilities() ?? null, |
| 696 | }); |
| 697 | const outcome = yield* resumeWithLifecycle(executionId, { action, content }); |
| 698 | if (!outcome) { |
| 699 | debugLog("resume.missing_execution", { executionId }); |
| 700 | return missingExecutionResult(executionId); |
| 701 | } |
| 702 | debugLog("resume.result", { |
| 703 | executionId, |
| 704 | status: outcome.status, |
| 705 | nextExecutionId: outcome.status === "paused" ? outcome.execution.id : undefined, |
| 706 | interactionKind: |
| 707 | outcome.status === "paused" |
| 708 | ? pausedInteractionKind(outcome.execution.elicitationContext.request) |
| 709 | : undefined, |
| 710 | }); |
| 711 | if (outcome.status === "paused") { |
| 712 | yield* Effect.annotateCurrentSpan({ |
| 713 | "mcp.execute.paused": true, |
| 714 | "mcp.execute.paused_execution_id": outcome.execution.id, |
| 715 | "mcp.execute.pause_source": "resume", |
| 716 | }); |
| 717 | yield* onExecutionPaused(outcome.execution.id); |
| 718 | } |
| 719 | return outcome.status === "completed" |
| 720 | ? toMcpResult(outcome.result) |
| 721 | : toMcpPausedResult(formatPausedExecution(outcome.execution)); |
| 722 | }).pipe( |
| 723 | Effect.withSpan("mcp.host.tool.resume", { |
| 724 | attributes: { |
| 725 | "mcp.tool.name": "resume", |
| 726 | "mcp.execute.resume.action": action, |
| 727 | "mcp.execute.execution_id": executionId, |
| 728 | }, |
| 729 | }), |
| 730 | ); |
| 731 | |
| 732 | const requireUserResumeApproval = (executionId: string): Effect.Effect<McpToolResult> => |
| 733 | Effect.sync(() => { |
no test coverage detected