@cyanheads/mcp-ts-core 0.13.11 → 0.13.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/AGENTS.md +9 -8
  2. package/CLAUDE.md +9 -8
  3. package/README.md +1 -1
  4. package/changelog/0.13.x/0.13.12.md +50 -0
  5. package/changelog/0.13.x/0.13.13.md +93 -0
  6. package/dist/core/context.d.ts +12 -0
  7. package/dist/core/context.d.ts.map +1 -1
  8. package/dist/core/context.js +59 -14
  9. package/dist/core/context.js.map +1 -1
  10. package/dist/core/worker.d.ts.map +1 -1
  11. package/dist/core/worker.js +21 -8
  12. package/dist/core/worker.js.map +1 -1
  13. package/dist/mcp-server/handlerContext.d.ts +14 -8
  14. package/dist/mcp-server/handlerContext.d.ts.map +1 -1
  15. package/dist/mcp-server/handlerContext.js +16 -9
  16. package/dist/mcp-server/handlerContext.js.map +1 -1
  17. package/dist/mcp-server/inputRequired.d.ts +18 -9
  18. package/dist/mcp-server/inputRequired.d.ts.map +1 -1
  19. package/dist/mcp-server/inputRequired.js +29 -15
  20. package/dist/mcp-server/inputRequired.js.map +1 -1
  21. package/dist/mcp-server/prompts/prompt-registration.d.ts.map +1 -1
  22. package/dist/mcp-server/prompts/prompt-registration.js +10 -7
  23. package/dist/mcp-server/prompts/prompt-registration.js.map +1 -1
  24. package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts.map +1 -1
  25. package/dist/mcp-server/resources/utils/resourceHandlerFactory.js +29 -19
  26. package/dist/mcp-server/resources/utils/resourceHandlerFactory.js.map +1 -1
  27. package/dist/mcp-server/tools/utils/inputPrevalidation.d.ts +8 -2
  28. package/dist/mcp-server/tools/utils/inputPrevalidation.d.ts.map +1 -1
  29. package/dist/mcp-server/tools/utils/inputPrevalidation.js +18 -7
  30. package/dist/mcp-server/tools/utils/inputPrevalidation.js.map +1 -1
  31. package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts +7 -1
  32. package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts.map +1 -1
  33. package/dist/mcp-server/tools/utils/toolHandlerFactory.js +107 -21
  34. package/dist/mcp-server/tools/utils/toolHandlerFactory.js.map +1 -1
  35. package/dist/mcp-server/transports/auth/lib/authUtils.d.ts +22 -0
  36. package/dist/mcp-server/transports/auth/lib/authUtils.d.ts.map +1 -1
  37. package/dist/mcp-server/transports/auth/lib/authUtils.js +29 -1
  38. package/dist/mcp-server/transports/auth/lib/authUtils.js.map +1 -1
  39. package/dist/mcp-server/transports/auth/lib/checkScopes.d.ts.map +1 -1
  40. package/dist/mcp-server/transports/auth/lib/checkScopes.js +2 -1
  41. package/dist/mcp-server/transports/auth/lib/checkScopes.js.map +1 -1
  42. package/dist/mcp-server/transports/http/httpErrorHandler.d.ts.map +1 -1
  43. package/dist/mcp-server/transports/http/httpErrorHandler.js +4 -2
  44. package/dist/mcp-server/transports/http/httpErrorHandler.js.map +1 -1
  45. package/dist/services/mirror/sqlite/handle.d.ts +13 -2
  46. package/dist/services/mirror/sqlite/handle.d.ts.map +1 -1
  47. package/dist/services/mirror/sqlite/handle.js +17 -6
  48. package/dist/services/mirror/sqlite/handle.js.map +1 -1
  49. package/dist/services/mirror/sqlite/sqliteMirrorStore.d.ts.map +1 -1
  50. package/dist/services/mirror/sqlite/sqliteMirrorStore.js +3 -2
  51. package/dist/services/mirror/sqlite/sqliteMirrorStore.js.map +1 -1
  52. package/dist/storage/providers/fileSystem/fileSystemProvider.d.ts.map +1 -1
  53. package/dist/storage/providers/fileSystem/fileSystemProvider.js +48 -21
  54. package/dist/storage/providers/fileSystem/fileSystemProvider.js.map +1 -1
  55. package/dist/types-global/errors.d.ts.map +1 -1
  56. package/dist/types-global/errors.js +31 -16
  57. package/dist/types-global/errors.js.map +1 -1
  58. package/dist/utils/internal/error-handler/errorHandler.d.ts +29 -11
  59. package/dist/utils/internal/error-handler/errorHandler.d.ts.map +1 -1
  60. package/dist/utils/internal/error-handler/errorHandler.js +204 -95
  61. package/dist/utils/internal/error-handler/errorHandler.js.map +1 -1
  62. package/dist/utils/internal/error-handler/helpers.d.ts +91 -9
  63. package/dist/utils/internal/error-handler/helpers.d.ts.map +1 -1
  64. package/dist/utils/internal/error-handler/helpers.js +243 -39
  65. package/dist/utils/internal/error-handler/helpers.js.map +1 -1
  66. package/dist/utils/internal/error-handler/types.d.ts +21 -4
  67. package/dist/utils/internal/error-handler/types.d.ts.map +1 -1
  68. package/dist/utils/internal/logValue.d.ts +33 -0
  69. package/dist/utils/internal/logValue.d.ts.map +1 -0
  70. package/dist/utils/internal/logValue.js +539 -0
  71. package/dist/utils/internal/logValue.js.map +1 -0
  72. package/dist/utils/internal/logger.d.ts +38 -9
  73. package/dist/utils/internal/logger.d.ts.map +1 -1
  74. package/dist/utils/internal/logger.js +228 -118
  75. package/dist/utils/internal/logger.js.map +1 -1
  76. package/dist/utils/internal/observabilityCap.d.ts +35 -0
  77. package/dist/utils/internal/observabilityCap.d.ts.map +1 -0
  78. package/dist/utils/internal/observabilityCap.js +43 -0
  79. package/dist/utils/internal/observabilityCap.js.map +1 -0
  80. package/dist/utils/internal/performance.d.ts.map +1 -1
  81. package/dist/utils/internal/performance.js +9 -11
  82. package/dist/utils/internal/performance.js.map +1 -1
  83. package/dist/utils/internal/requestContext.d.ts +3 -3
  84. package/dist/utils/internal/requestContext.js +1 -1
  85. package/dist/utils/network/fetchWithTimeout.d.ts +20 -10
  86. package/dist/utils/network/fetchWithTimeout.d.ts.map +1 -1
  87. package/dist/utils/network/fetchWithTimeout.js +112 -30
  88. package/dist/utils/network/fetchWithTimeout.js.map +1 -1
  89. package/dist/utils/network/httpError.d.ts +8 -6
  90. package/dist/utils/network/httpError.d.ts.map +1 -1
  91. package/dist/utils/network/httpError.js +23 -7
  92. package/dist/utils/network/httpError.js.map +1 -1
  93. package/dist/utils/network/retry.d.ts +25 -2
  94. package/dist/utils/network/retry.d.ts.map +1 -1
  95. package/dist/utils/network/retry.js +47 -5
  96. package/dist/utils/network/retry.js.map +1 -1
  97. package/dist/utils/security/sanitization.d.ts +24 -28
  98. package/dist/utils/security/sanitization.d.ts.map +1 -1
  99. package/dist/utils/security/sanitization.js +25 -84
  100. package/dist/utils/security/sanitization.js.map +1 -1
  101. package/dist/utils/security/sensitiveFields.d.ts +32 -4
  102. package/dist/utils/security/sensitiveFields.d.ts.map +1 -1
  103. package/dist/utils/security/sensitiveFields.js +85 -4
  104. package/dist/utils/security/sensitiveFields.js.map +1 -1
  105. package/dist/utils/telemetry/trace.d.ts +3 -1
  106. package/dist/utils/telemetry/trace.d.ts.map +1 -1
  107. package/dist/utils/telemetry/trace.js +6 -6
  108. package/dist/utils/telemetry/trace.js.map +1 -1
  109. package/framework-skills/api-auth/SKILL.md +3 -1
  110. package/framework-skills/api-canvas/SKILL.md +2 -2
  111. package/framework-skills/api-config/SKILL.md +2 -1
  112. package/framework-skills/api-context/SKILL.md +6 -6
  113. package/framework-skills/api-errors/SKILL.md +19 -17
  114. package/framework-skills/api-linter/SKILL.md +11 -10
  115. package/framework-skills/api-mirror/SKILL.md +3 -1
  116. package/framework-skills/api-telemetry/SKILL.md +14 -8
  117. package/framework-skills/api-utils/SKILL.md +6 -6
  118. package/framework-skills/api-utils/references/security.md +4 -2
  119. package/framework-skills/field-test/SKILL.md +2 -2
  120. package/framework-skills/git-wrapup/SKILL.md +3 -3
  121. package/framework-skills/tool-defs-analysis/SKILL.md +2 -2
  122. package/package.json +10 -9
  123. package/scripts/check-framework-antipatterns.ts +3 -2
  124. package/templates/.env.example +2 -0
  125. package/templates/tests/tools/echo.tool.test.ts +19 -1
@@ -4,16 +4,18 @@
4
4
  * @module src/utils/internal/error-handler/errorHandler
5
5
  */
6
6
  import { SdkError, SdkErrorCode } from '@modelcontextprotocol/server';
7
- import { SpanStatusCode, trace } from '@opentelemetry/api';
7
+ import { trace } from '@opentelemetry/api';
8
8
  import { ZodError } from 'zod';
9
9
  import { isInputRequiredSignal } from '../../../mcp-server/inputRequired.js';
10
10
  import { JsonRpcErrorCode, McpError, requestCancelled } from '../../../types-global/errors.js';
11
11
  import { logger } from '../logger.js';
12
+ import { toLogValue } from '../logValue.js';
12
13
  import { generateUUID } from '../../security/idGenerator.js';
13
14
  import { sanitizeInputForLogging } from '../../security/sanitization.js';
14
15
  import { ATTR_MCP_ERROR_CATEGORY, ATTR_MCP_ERROR_CLASSIFIED_CODE, ATTR_MCP_ERROR_SEVERITY, } from '../../telemetry/attributes.js';
15
16
  import { createCounter } from '../../telemetry/metrics.js';
16
- import { extractErrorCauseChain, getErrorMessage, getErrorName } from './helpers.js';
17
+ import { isRecord } from '../../types/guards.js';
18
+ import { asError, copyFields, errorText, extractErrorCauseChain, getErrorMessage, getErrorName, isInstance, readErrorData, readField, readWireErrorData, recordSpanFailure, UNREADABLE, } from './helpers.js';
17
19
  import { COMPILED_ERROR_PATTERNS, COMPILED_PROVIDER_PATTERNS, ENGINE_RESOURCE_LIMIT_MESSAGES, ERROR_TYPE_MAPPINGS, getCompiledPattern, getErrorCategory, } from './mappings.js';
18
20
  let errorClassifiedCounter;
19
21
  function getErrorMetrics() {
@@ -24,6 +26,33 @@ function getErrorMetrics() {
24
26
  export function initErrorMetrics() {
25
27
  getErrorMetrics();
26
28
  }
29
+ /**
30
+ * A record's `extra` as a stack-free record writes it, every field in one walk
31
+ * — the context's, `input`, `errorData`: each `Error` written without its
32
+ * `stack`, no `stack`, and none of `errorData`'s stack fields (`originalStack`,
33
+ * and on each `causeChain` node its `stack` and the same fields in its `data`).
34
+ * `extra` is the record's own object literal, so the walk returns an object
35
+ * whatever the context's `extra` was.
36
+ */
37
+ function toStackFreeExtra(extra) {
38
+ const { stack: _stack, ...rest } = toLogValue(extra, { includeStack: false });
39
+ if (isRecord(rest.errorData))
40
+ dropStackFields(rest.errorData);
41
+ return rest;
42
+ }
43
+ /** Deletes the record's stack fields from `data`, a walked copy, down its `causeChain`. */
44
+ function dropStackFields(data) {
45
+ delete data.originalStack;
46
+ if (!Array.isArray(data.causeChain))
47
+ return;
48
+ for (const node of data.causeChain) {
49
+ if (!isRecord(node))
50
+ continue;
51
+ delete node.stack;
52
+ if (isRecord(node.data))
53
+ dropStackFields(node.data);
54
+ }
55
+ }
27
56
  /**
28
57
  * The value a handler unwound with, resolved against its request's cancellation.
29
58
  *
@@ -58,8 +87,10 @@ export function initErrorMetrics() {
58
87
  export function asRequestCancelled(error, signal) {
59
88
  if (!signal.aborted || isInputRequiredSignal(error))
60
89
  return error;
61
- if (error instanceof McpError && error.code === JsonRpcErrorCode.RequestCancelled)
90
+ if (isInstance(error, McpError) &&
91
+ readField(error, 'code') === JsonRpcErrorCode.RequestCancelled) {
62
92
  return error;
93
+ }
63
94
  return requestCancelled(getErrorMessage(error), undefined, { cause: error });
64
95
  }
65
96
  /**
@@ -76,7 +107,7 @@ export class ErrorHandler {
76
107
  * which outranks every step below.
77
108
  *
78
109
  * Resolution order:
79
- * 1. `McpError` instances — returns `error.code` directly.
110
+ * 1. `McpError` instances — returns `error.code` directly (`InternalError` when the code cannot be read).
80
111
  * 2. SDK `ConnectionClosed` rejections — mapped to `RequestCancelled`, ahead of the pattern ladder.
81
112
  * 3. Engine resource-limit `RangeError`s — a whole message in `ENGINE_RESOURCE_LIMIT_MESSAGES`
82
113
  * (stack overflow, maximum string size) maps to `InternalError` (#482).
@@ -102,8 +133,14 @@ export class ErrorHandler {
102
133
  * ```
103
134
  */
104
135
  static determineErrorCode(error) {
105
- if (error instanceof McpError) {
106
- return error.code;
136
+ /**
137
+ * Every read of the thrown value is guarded (#697): a value `instanceof`
138
+ * cannot inspect (a revoked `Proxy`) is classified as a non-Error, and a
139
+ * field whose read throws as `'[Unreadable]'`.
140
+ */
141
+ if (isInstance(error, McpError)) {
142
+ const code = readField(error, 'code');
143
+ return code === UNREADABLE ? JsonRpcErrorCode.InternalError : code;
107
144
  }
108
145
  /**
109
146
  * The SDK rejects every request still in flight when the transport closes,
@@ -112,7 +149,7 @@ export class ErrorHandler {
112
149
  * one wording, and the one that says "aborted" would otherwise be caught by
113
150
  * the generic abort pattern below and read as a `Timeout`.
114
151
  */
115
- if (error instanceof SdkError && error.code === SdkErrorCode.ConnectionClosed) {
152
+ if (isInstance(error, SdkError) && readField(error, 'code') === SdkErrorCode.ConnectionClosed) {
116
153
  return JsonRpcErrorCode.RequestCancelled;
117
154
  }
118
155
  const errorName = getErrorName(error);
@@ -144,10 +181,7 @@ export class ErrorHandler {
144
181
  }
145
182
  }
146
183
  // Special-case common platform errors
147
- if (typeof error === 'object' &&
148
- error !== null &&
149
- 'name' in error &&
150
- error.name === 'AbortError') {
184
+ if (typeof error === 'object' && error !== null && readField(error, 'name') === 'AbortError') {
151
185
  return JsonRpcErrorCode.Timeout;
152
186
  }
153
187
  return JsonRpcErrorCode.InternalError;
@@ -158,14 +192,24 @@ export class ErrorHandler {
158
192
  * Steps performed:
159
193
  * 1. Records the exception on the active OTel span and sets span status to ERROR.
160
194
  * 2. Sanitizes `options.input` via `sanitizeInputForLogging` before including in logs.
161
- * 3. Extracts and consolidates error data, original stack, and the full cause chain.
195
+ * 3. Extracts and consolidates error data and the full cause chain.
162
196
  * 4. Rebuilds the error as a new `McpError` carrying the consolidated data — the thrown
163
- * error's own `data`, `originalErrorName`, `originalMessage`, and `rootCause` — preserving
164
- * the classified code (or delegates to `options.errorMapper`). That `data` is client-visible
165
- * once the error is thrown toward a handler, so it carries no stack and no `context`:
166
- * `originalStack`, `causeChain`, and the context ride the log record only.
197
+ * error's own `data`, `originalErrorName`, and `originalMessage` — preserving the classified
198
+ * code (or delegates to `options.errorMapper`). That `data` is client-visible once the error
199
+ * is thrown toward a handler, so it carries nothing derived from a cause, no stack, and no
200
+ * `context`: `rootCause`, `causeChain`, and the context ride the log record only. The
201
+ * rebuilt error takes the thrown error's stack, so it starts at the throw site.
167
202
  * 5. Logs the result via the global logger with full structured context — at `error` level,
168
- * or at `info` without a stack for `RequestCancelled`, which is a routine caller disconnect.
203
+ * with the throw site's stack as the record's `stack` (none for a thrown value without one,
204
+ * and never a context's `extra.stack`), and each stack written once: a `causeChain` node
205
+ * carrying the record's stack, or the same stack as the node before it, is written without
206
+ * it. The handler's own fields lead the record, ahead of the context's `extra` and `input`,
207
+ * and no caller key replaces one. A field of the thrown value whose read throws is written
208
+ * as `'[Unreadable]'`, so the call never throws on what it reports.
209
+ * A record is stack-free for `RequestCancelled`, which is a routine caller disconnect logged
210
+ * at `info`, and under `includeStack: false`: no `stack`, no `errorData.originalStack`, no
211
+ * `causeChain` node `stack` nor `originalStack` in a node's `data`, and every `Error` in the
212
+ * record written without its `stack` (see `ErrorHandlerOptions`).
169
213
  * 6. Returns the processed error, or rethrows it if `options.rethrow` is `true`.
170
214
  *
171
215
  * @param error - The error instance or value that occurred.
@@ -191,34 +235,42 @@ export class ErrorHandler {
191
235
  // --- OpenTelemetry Integration ---
192
236
  // Skip ended/no-op spans — measure*Execution paths already record + end the span before re-throwing.
193
237
  const activeSpan = trace.getActiveSpan();
194
- if (activeSpan?.isRecording()) {
195
- if (error instanceof Error) {
196
- activeSpan.recordException(error);
197
- }
198
- activeSpan.setStatus({
199
- code: SpanStatusCode.ERROR,
200
- message: error instanceof Error ? error.message : String(error),
201
- });
202
- }
238
+ if (activeSpan?.isRecording())
239
+ recordSpanFailure(activeSpan, error);
203
240
  // --- End OpenTelemetry Integration ---
204
241
  const { context = {}, operation, input, rethrow = false, errorCode: explicitErrorCode, includeStack = true, critical = false, errorMapper, severity, } = options;
205
242
  const sanitizedInput = input !== undefined ? sanitizeInputForLogging(input) : undefined;
243
+ /**
244
+ * Every read of the thrown value is guarded: a `name`, `message`, `stack`,
245
+ * `cause`, or an `McpError`'s `code` whose read throws (a getter, a revoked
246
+ * `Proxy`), or a `data` that cannot be read or copied, is written as
247
+ * `'[Unreadable]'` or left out, and a value `instanceof` cannot inspect is
248
+ * handled as a non-Error, so reporting a failure never fails itself (#697).
249
+ */
206
250
  const originalErrorName = getErrorName(error);
207
251
  const originalErrorMessage = getErrorMessage(error);
208
- const originalStack = error instanceof Error ? error.stack : undefined;
252
+ const thrownError = isInstance(error, Error) ? error : undefined;
253
+ const thrownMcpError = isInstance(error, McpError) ? error : undefined;
254
+ const originalStack = thrownError ? readField(thrownError, 'stack') : undefined;
209
255
  /**
210
256
  * Classified before the record is assembled, because the code decides more
211
257
  * than the wire response: a caller-abandoned request is a routine event, so
212
258
  * it is logged at `info` and carries no stack. Attaching one invites triage
213
259
  * to read a client hanging up as a fault in this server.
214
260
  */
215
- const loggedErrorCode = error instanceof McpError
216
- ? error.code
261
+ const loggedErrorCode = thrownMcpError
262
+ ? ErrorHandler.determineErrorCode(thrownMcpError)
217
263
  : explicitErrorCode || ErrorHandler.determineErrorCode(error);
218
264
  const isCancellation = loggedErrorCode === JsonRpcErrorCode.RequestCancelled;
219
- const errorDataSeed = error instanceof McpError && typeof error.data === 'object' && error.data !== null
220
- ? { ...error.data }
221
- : {};
265
+ /**
266
+ * A stack-free record has none of the stack fields `ErrorHandlerOptions.includeStack`
267
+ * lists, and writes every `Error` in it without its `stack` — whether this
268
+ * handler, the thrown `McpError`'s own `data`, the context, or `input`
269
+ * supplied it (#650). Any other key named `stack` is a caller's data and is
270
+ * written as given. The returned error is the same either way.
271
+ */
272
+ const stackFree = !includeStack || isCancellation;
273
+ const errorDataSeed = readErrorData(error) ?? {};
222
274
  /**
223
275
  * `consolidatedData` becomes `McpError.data`, which the tool handler puts on
224
276
  * `structuredContent.error.data`. It carries the thrown error's own data and
@@ -233,30 +285,58 @@ export class ErrorHandler {
233
285
  originalMessage: originalErrorMessage,
234
286
  };
235
287
  /**
236
- * Stack-bearing diagnostics go to the log record only, never into the
288
+ * What the cause chain says goes to the log record only, never into the
237
289
  * returned error's `data`: `tryCatch` throws that error, and tools and
238
- * resources forward an `McpError`'s `data` to the client verbatim (#519).
239
- * A cancellation carries neither — its every node would hold a stack and
240
- * invite triage to read a caller hanging up as a fault in this server.
290
+ * resources forward an `McpError`'s `data` to the client verbatim (#519),
291
+ * so a message redacted at the throw site would reach the client raw
292
+ * through its cause (#644). A cancellation carries no chain — its every
293
+ * node would hold a stack and invite triage to read a caller hanging up
294
+ * as a fault in this server. `includeStack: false` keeps the chain, and
295
+ * the stack-free record logs none of its nodes' stacks (#586).
241
296
  */
242
297
  const diagnostics = {};
243
- if (originalStack &&
244
- !isCancellation &&
245
- !(error instanceof McpError && error.data?.originalStack)) {
246
- diagnostics.originalStack = originalStack;
247
- }
248
- const cause = error instanceof Error ? error : undefined;
249
- if (!isCancellation && error instanceof Error && error.cause) {
250
- const causeChain = extractErrorCauseChain(error);
298
+ if (!isCancellation && thrownError && readField(thrownError, 'cause')) {
299
+ const causeChain = extractErrorCauseChain(thrownError);
251
300
  const rootCause = causeChain.at(-1);
252
301
  if (rootCause) {
253
- consolidatedData.rootCause = { name: rootCause.name, message: rootCause.message };
254
- diagnostics.causeChain = causeChain;
302
+ diagnostics.rootCause = { name: rootCause.name, message: rootCause.message };
303
+ /**
304
+ * A node whose stack is the record's own, or the node's before it, is
305
+ * written without it — the rule the log walk applies to an `Error`'s
306
+ * `cause` — so the record carries each stack once (#694): the thrown
307
+ * error itself, and every error a nested `tryCatch` rebuilt from
308
+ * another. A stack that could not be read is no stack to repeat.
309
+ */
310
+ diagnostics.causeChain = causeChain.map((node, i) => {
311
+ const { stack } = node;
312
+ const repeated = stack === originalStack || stack === causeChain[i - 1]?.stack;
313
+ if (stack === undefined || stack === UNREADABLE || !repeated)
314
+ return node;
315
+ const { stack: _stack, ...rest } = node;
316
+ return rest;
317
+ });
255
318
  }
256
319
  }
257
320
  const finalError = errorMapper
258
321
  ? errorMapper(error)
259
- : new McpError(loggedErrorCode, originalErrorMessage, consolidatedData, { cause });
322
+ : new McpError(loggedErrorCode, originalErrorMessage, consolidatedData, {
323
+ cause: thrownError,
324
+ });
325
+ /**
326
+ * The rebuilt error takes the throw site's stack, so the error `tryCatch`
327
+ * rethrows starts where the failure happened rather than here (#694). It is
328
+ * copied verbatim: the header line names the class that was thrown, and
329
+ * `finalErrorType` on the record names the rebuilt one. A mapper's result
330
+ * keeps the stack its mapper gave it, and takes the throw site's only when
331
+ * it has none. A throw-site stack that could not be read is not copied.
332
+ */
333
+ if (typeof originalStack === 'string' &&
334
+ originalStack &&
335
+ originalStack !== UNREADABLE &&
336
+ finalError !== error &&
337
+ (!errorMapper || !finalError.stack)) {
338
+ finalError.stack = originalStack;
339
+ }
260
340
  /**
261
341
  * Record error classification metric. The category is the same
262
342
  * `getErrorCategory` answer the per-surface error counters carry, handed
@@ -264,53 +344,71 @@ export class ErrorHandler {
264
344
  * under `server` rather than upstream throttling (#481). The resolved
265
345
  * severity is a bounded dimension and rides as an attribute; it is present
266
346
  * only when one resolved — a declared entry's, or `notice` for the
267
- * framework's argument and capability refusals (#567). The `reason` behind
268
- * either never becomes a metric attribute —
347
+ * framework's argument and capability refusals (#567) and a scope check's
348
+ * missing-scope refusal (#585). The `reason` behind any of them never
349
+ * becomes a metric attribute —
269
350
  * unbounded across a fleet, so it belongs on the span and in the log.
270
351
  */
271
352
  getErrorMetrics().errorClassifiedCounter.add(1, {
272
353
  [ATTR_MCP_ERROR_CLASSIFIED_CODE]: String(loggedErrorCode),
273
- [ATTR_MCP_ERROR_CATEGORY]: getErrorCategory(loggedErrorCode, error instanceof McpError ? error.data : undefined),
354
+ [ATTR_MCP_ERROR_CATEGORY]: getErrorCategory(loggedErrorCode, errorDataSeed),
274
355
  operation,
275
356
  ...(severity !== undefined && { [ATTR_MCP_ERROR_SEVERITY]: severity }),
276
357
  });
277
- if (finalError !== error &&
278
- error instanceof Error &&
279
- finalError instanceof Error &&
280
- !finalError.stack &&
281
- error.stack) {
282
- finalError.stack = error.stack;
283
- }
284
- const logRequestId = typeof context.requestId === 'string' && context.requestId
285
- ? context.requestId
358
+ /**
359
+ * The context is read once, through these copies: a field that throws when
360
+ * read — an own getter, a `Proxy` trap — would otherwise fail the call that
361
+ * reports a failure. A copy that throws is written as `'[Unreadable]'` in
362
+ * the record, under `context` or `extra`.
363
+ */
364
+ const contextFields = copyFields(context);
365
+ const { extra: contextExtra, ...contextCanonical } = contextFields ?? {};
366
+ const extraFields = copyFields(contextExtra);
367
+ const logRequestId = typeof contextCanonical.requestId === 'string' && contextCanonical.requestId
368
+ ? contextCanonical.requestId
286
369
  : generateUUID();
287
- const logTimestamp = typeof context.timestamp === 'string' && context.timestamp
288
- ? context.timestamp
370
+ const logTimestamp = typeof contextCanonical.timestamp === 'string' && contextCanonical.timestamp
371
+ ? contextCanonical.timestamp
289
372
  : new Date().toISOString();
290
- const stack = finalError instanceof Error ? finalError.stack : originalStack;
291
- const { extra: contextExtra, ...contextCanonical } = context;
373
+ /**
374
+ * Read and copied as the thrown value's is: an `errorMapper` may return the
375
+ * very error it was given. A `data` that cannot be read or copied gives way
376
+ * to `consolidatedData`.
377
+ */
378
+ const errorData = { ...(readErrorData(finalError) ?? consolidatedData), ...diagnostics };
379
+ const handlerFields = {
380
+ critical,
381
+ errorCode: loggedErrorCode,
382
+ originalErrorType: originalErrorName,
383
+ finalErrorType: getErrorName(finalError),
384
+ errorData,
385
+ // The record's one stack: the throw site's, absent for a thrown value with none (#694).
386
+ ...(originalStack ? { stack: originalStack } : {}),
387
+ };
388
+ // A context's `extra.stack` never stands in for the throw site's (#694).
389
+ const { stack: _contextStack, ...callerExtra } = extraFields ?? { extra: UNREADABLE };
390
+ /**
391
+ * The handler's own fields lead the record, so the log walk, which works
392
+ * in key order, reaches `errorData` before caller-sized `extra` and `input`
393
+ * can spend its bound on what it writes (#649); spread again last, so a
394
+ * caller's key never replaces one.
395
+ */
396
+ const recordExtra = {
397
+ ...handlerFields,
398
+ ...callerExtra,
399
+ ...(contextFields === undefined && { context: UNREADABLE }),
400
+ input: sanitizedInput,
401
+ ...handlerFields,
402
+ };
292
403
  const logContext = {
293
404
  operation,
294
405
  ...contextCanonical,
295
406
  requestId: logRequestId,
296
407
  timestamp: logTimestamp,
297
- extra: {
298
- ...contextExtra,
299
- input: sanitizedInput,
300
- critical,
301
- errorCode: loggedErrorCode,
302
- originalErrorType: originalErrorName,
303
- finalErrorType: getErrorName(finalError),
304
- errorData: {
305
- ...(finalError instanceof McpError && finalError.data
306
- ? finalError.data
307
- : consolidatedData),
308
- ...diagnostics,
309
- },
310
- ...(includeStack && stack && !isCancellation ? { stack } : {}),
311
- },
408
+ extra: stackFree ? toStackFreeExtra(recordExtra) : recordExtra,
312
409
  };
313
- const logDescription = finalError.message || originalErrorMessage;
410
+ const finalMessage = readField(finalError, 'message');
411
+ const logDescription = finalMessage ? errorText(finalMessage) : originalErrorMessage;
314
412
  if (isCancellation) {
315
413
  logger.info(`Cancelled ${operation}: ${logDescription}`, logContext);
316
414
  }
@@ -339,14 +437,17 @@ export class ErrorHandler {
339
437
  * the full `issues` array so clients can render field-level errors).
340
438
  */
341
439
  static classifyOnly(error) {
342
- if (error instanceof McpError) {
343
- return { code: error.code, message: error.message };
440
+ if (isInstance(error, McpError)) {
441
+ return {
442
+ code: ErrorHandler.determineErrorCode(error),
443
+ message: errorText(readField(error, 'message')),
444
+ };
344
445
  }
345
- if (error instanceof ZodError) {
446
+ if (isInstance(error, ZodError)) {
346
447
  return {
347
448
  code: JsonRpcErrorCode.ValidationError,
348
449
  message: getErrorMessage(error),
349
- data: { issues: error.issues },
450
+ data: { issues: readField(error, 'issues') },
350
451
  };
351
452
  }
352
453
  return {
@@ -392,15 +493,23 @@ export class ErrorHandler {
392
493
  if (defaultFactory) {
393
494
  return defaultFactory(error);
394
495
  }
395
- return error instanceof Error ? error : new Error(String(error));
496
+ return asError(error);
396
497
  }
397
498
  /**
398
499
  * Formats an error into a consistent `{ code, message, data }` structure for API responses or structured logging.
399
500
  *
400
- * - `McpError` → `{ code: error.code, message: error.message, data: error.data ?? {} }`
501
+ * - `McpError` → `{ code: error.code, message: error.message, data: <a copy of error.data> ?? {} }`
401
502
  * - `Error` → `{ code: determineErrorCode(error), message: error.message, data: { errorType: error.name } }`
402
503
  * - Other values → `{ code: JsonRpcErrorCode.UnknownError, message: getErrorMessage(value), data: { errorType: getErrorName(value) } }`
403
504
  *
505
+ * Never throws on the value it formats: a `message` or `name` whose read throws is
506
+ * `'[Unreadable]'`, one that is not a string is written as text (`String` for a
507
+ * primitive, `'[Unreadable]'` for an object), a `data` that cannot be read or copied
508
+ * (a revoked `Proxy`) is `{}`, and a value `instanceof` cannot inspect (a revoked
509
+ * `Proxy`) is formatted as a non-Error. Every `data` field is one a response can
510
+ * carry: one `JSON.stringify` cannot write is `'[Unreadable]'`, and one that takes
511
+ * more than 1,000,000 JSON values to write is `'[Truncated]'`.
512
+ *
404
513
  * @param error - The error instance or value to format.
405
514
  * @returns A plain object with `code` (numeric `JsonRpcErrorCode`), `message` (string), and `data` (object).
406
515
  *
@@ -414,18 +523,18 @@ export class ErrorHandler {
414
523
  * ```
415
524
  */
416
525
  static formatError(error) {
417
- if (error instanceof McpError) {
526
+ if (isInstance(error, McpError)) {
418
527
  return {
419
- code: error.code,
420
- message: error.message,
421
- data: typeof error.data === 'object' && error.data !== null ? error.data : {},
528
+ code: ErrorHandler.determineErrorCode(error),
529
+ message: errorText(readField(error, 'message')),
530
+ data: readWireErrorData(error) ?? {},
422
531
  };
423
532
  }
424
- if (error instanceof Error) {
533
+ if (isInstance(error, Error)) {
425
534
  return {
426
535
  code: ErrorHandler.determineErrorCode(error),
427
- message: error.message,
428
- data: { errorType: error.name || 'Error' },
536
+ message: errorText(readField(error, 'message')),
537
+ data: { errorType: getErrorName(error) },
429
538
  };
430
539
  }
431
540
  return {
@@ -443,9 +552,9 @@ export class ErrorHandler {
443
552
  * error-handling boilerplate.
444
553
  *
445
554
  * The thrown error's `data` reaches the client when a tool or resource handler lets it propagate,
446
- * so it carries the caught error's own `data`, `originalErrorName`, `originalMessage`, and
447
- * `rootCause`, but no stack and nothing from `options.context`; the throw-site stack, the cause
448
- * chain, and the context are logged (#548).
555
+ * so it carries the caught error's own `data`, `originalErrorName`, and `originalMessage`, but
556
+ * nothing derived from a cause, no stack, and nothing from `options.context`; the throw-site
557
+ * stack, `rootCause`, the cause chain, and the context are logged (#548, #644).
449
558
  *
450
559
  * @template T The expected return type of `fn`.
451
560
  * @param fn - The function to execute. May be synchronous or return a `Promise`.
@@ -1 +1 @@
1
- {"version":3,"file":"errorHandler.js","sourceRoot":"","sources":["../../../../src/utils/internal/error-handler/errorHandler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAE/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACxF,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EACL,uBAAuB,EACvB,8BAA8B,EAC9B,uBAAuB,GACxB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,8BAA8B,EAC9B,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAGvB,IAAI,sBAAoE,CAAC;AAEzE,SAAS,eAAe;IACtB,sBAAsB,KAAK,aAAa,CACtC,uBAAuB,EACvB,gDAAgD,EAChD,UAAU,CACX,CAAC;IACF,OAAO,EAAE,sBAAsB,EAAE,CAAC;AACpC,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,g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