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

Function toMcpFailureResult

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

Source from the content-addressed store, hash-verified

522});
523
524const toMcpFailureResult = (cause: Cause.Cause<unknown>): McpToolResult => {
525 const correlationId = newCorrelationId();
526 // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: best-effort defect logging must tolerate non-serializable causes
527 try {
528 console.error(
529 `[executor:mcp] execute defect correlation_id=${correlationId}`,
530 Cause.pretty(cause),
531 );
532 } catch {
533 /* ignore logger failures */
534 }
535 const text = `Internal tool error [${correlationId}]`;
536 return {
537 content: [{ type: "text", text: `Error: ${text}` }],
538 structuredContent: { status: "error", error: text },
539 isError: true,
540 };
541};
542
543const recoveryText =
544 "To recover, run the execute tool again with the original code; if it pauses, a fresh executionId will be issued.";

Callers 1

runToolEffectFunction · 0.85

Calls 2

errorMethod · 0.80
newCorrelationIdFunction · 0.70

Tested by

no test coverage detected