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

Function resumeExecution

packages/hosts/mcp/src/tool-server.ts:1847–1899  ·  view source on GitHub ↗
(
      executionId: string,
      response: ResumeResponse,
      extra: McpRequestJoinKeys,
    )

Source from the content-addressed store, hash-verified

1845 );
1846
1847 const resumeExecution = (
1848 executionId: string,
1849 response: ResumeResponse,
1850 extra: McpRequestJoinKeys,
1851 ): Effect.Effect<McpToolResult, E> =>
1852 Effect.gen(function* () {
1853 yield* startMarker("mcp.host.tool.resume.start", {
1854 "mcp.tool.name": "resume",
1855 "mcp.execute.execution_id": executionId,
1856 });
1857 debugLog("resume.call", {
1858 executionId,
1859 action: response.action,
1860 hasContent: response.content !== undefined,
1861 persist: response.meta?.persist,
1862 clientCapabilities: server.server.getClientCapabilities() ?? null,
1863 });
1864 const outcome = yield* resumeWithLifecycle(executionId, response);
1865 if (!outcome) {
1866 debugLog("resume.missing_execution", { executionId });
1867 if (yield* localExecutionAlreadySettled(executionId)) {
1868 return alreadySettledResult(executionId);
1869 }
1870 const fallback = yield* resumeFallback(executionId, response);
1871 if (fallback) {
1872 debugLog("resume.fallback_result", { executionId, status: fallback.status });
1873 return fallbackOutcomeResult(executionId, fallback);
1874 }
1875 return missingExecutionResult(executionId);
1876 }
1877 debugLog("resume.result", {
1878 executionId,
1879 status: outcome.status,
1880 nextExecutionId: outcome.status === "paused" ? outcome.execution.id : undefined,
1881 interactionKind:
1882 outcome.status === "paused"
1883 ? pausedInteractionKind(outcome.execution.elicitationContext.request)
1884 : undefined,
1885 });
1886 if (outcome.status === "paused") {
1887 return yield* formatPausedModelResult(outcome.execution, "resume");
1888 }
1889 return toMcpResult(outcome.result);
1890 }).pipe(
1891 Effect.withSpan("mcp.host.tool.resume", {
1892 attributes: {
1893 "mcp.tool.name": "resume",
1894 "mcp.execute.resume.action": response.action,
1895 "mcp.execute.execution_id": executionId,
1896 },
1897 }),
1898 Effect.annotateSpans(joinKeyAttributes(extra)),
1899 );
1900
1901 const requireUserResumeApproval = (executionId: string): Effect.Effect<McpToolResult> =>
1902 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