Skip to content

Commit fa77f22

Browse files
chore(internal): show error causes in MCP servers when running in local mode
1 parent e862e90 commit fa77f22

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

packages/mcp-server/src/code-tool-worker.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ function makeSdkProxy<T extends object>(obj: T, { path, isBelievedBad = false }:
189189

190190
function parseError(code: string, error: unknown): string | undefined {
191191
if (!(error instanceof Error)) return;
192-
const message = error.name ? `${error.name}: ${error.message}` : error.message;
192+
const cause = error.cause instanceof Error ? `: ${error.cause.message}` : '';
193+
const message = error.name ? `${error.name}: ${error.message}${cause}` : `${error.message}${cause}`;
193194
try {
194195
// Deno uses V8; the first "<anonymous>:LINE:COLUMN" is the top of stack.
195196
const lineNumber = error.stack?.match(/<anonymous>:([0-9]+):[0-9]+/)?.[1];

0 commit comments

Comments
 (0)