(outcome: FormattedExecuteInput)
| 721 | * (sandbox error, emitted output) keeps the codemode rendering. |
| 722 | */ |
| 723 | const toPassthroughResult = (outcome: FormattedExecuteInput): McpToolResult => { |
| 724 | const value = outcome.result; |
| 725 | if (outcome.error || !isToolResult(value)) return toMcpResult(outcome); |
| 726 | if (value.ok) { |
| 727 | return toMcpResult({ ...outcome, result: value.data }); |
| 728 | } |
| 729 | const message = `${value.error.code}: ${value.error.message}`; |
| 730 | return { |
| 731 | content: [{ type: "text", text: `Error: ${message}` }], |
| 732 | structuredContent: { |
| 733 | status: "error", |
| 734 | error: value.error, |
| 735 | logs: outcome.logs ?? [], |
| 736 | }, |
| 737 | isError: true, |
| 738 | }; |
| 739 | }; |
| 740 | |
| 741 | /** |
| 742 | * A passthrough tool asked the user for something and the connected client |
no test coverage detected