Skip to content

Commit ec19dfb

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

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

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

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

0 commit comments

Comments
 (0)