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

Function toMcpFailureResult

packages/hosts/mcp/src/tool-server.ts:475–492  ·  view source on GitHub ↗
(cause: Cause.Cause<unknown>)

Source from the content-addressed store, hash-verified

473});
474
475const toMcpFailureResult = (cause: Cause.Cause<unknown>): McpToolResult => {
476 const correlationId = newCorrelationId();
477 // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: best-effort defect logging must tolerate non-serializable causes
478 try {
479 console.error(
480 `[executor:mcp] execute defect correlation_id=${correlationId}`,
481 Cause.pretty(cause),
482 );
483 } catch {
484 /* ignore logger failures */
485 }
486 const text = `Internal tool error [${correlationId}]`;
487 return {
488 content: [{ type: "text", text: `Error: ${text}` }],
489 structuredContent: { status: "error", error: text },
490 isError: true,
491 };
492};
493
494// A paused execution lives in the session runtime's memory: it expires when
495// the user takes too long to answer, and dies early when the runtime is

Callers 1

runToolEffectFunction · 0.85

Calls 2

errorMethod · 0.80
newCorrelationIdFunction · 0.70

Tested by

no test coverage detected