{"record":{"id":"3304a668eded8040","repo":"koala73/worldmonitor","slug":"tool-output-exceeded-the-safe-output-limit","errorCode":null,"errorMessage":"Tool output exceeded the safe output limit.","messagePattern":"Tool output exceeded the safe output limit\\.","errorType":"exception","errorClass":"SafeWebMcpError","httpStatus":null,"severity":"error","filePath":"src/services/webmcp.ts","lineNumber":804,"sourceCode":"      tool: name,\n      targetCancellationSupported: Boolean(signal),\n    });\n    try {\n      throwIfWebMcpAborted(signal);\n      const preflightResult = await hooks.preflight?.(args, execution);\n      throwIfWebMcpAborted(signal);\n      let result: unknown;\n      if (preflightResult !== undefined) {\n        result = preflightResult;\n      } else if (CANCELLATION_REQUIRED_WEBMCP_TOOLS.has(name) && !signal) {\n        // This tool declared that a phantom completion would be unsafe, and\n        // the host cannot deliver the target-side signal. Return a structured\n        // denial because some hosts erase the name and message of errors\n        // raised by the page callback.\n        result = unsupportedCancellationResult();\n      } else {\n        result = await fn(args, execution);\n        // Browser cancellation rejects executeTool independently of this\n        // callback. Re-check here so late work cannot publish success telemetry\n        // after the host has already cancelled the invocation.\n        throwIfWebMcpAborted(signal);\n      }\n      enforceOutputBudget(result);\n      const invocation = classifyInvocationResult(result);\n      reportWebMcpEvent(trackEvent, 'webmcp-tool-invoked', {\n        tool: name,\n        ...invocation,\n        ...(hooks.successMetadata?.(args, result) ?? {}),\n      });\n      return result;\n    } catch (error) {\n      const reason = signal?.aborted\n        ? 'cancelled'\n        : classifyInvocationError(error);\n      reportWebMcpEvent(trackEvent, 'webmcp-tool-invoked', {\n        tool: name,","sourceCodeStart":786,"sourceCodeEnd":822,"githubUrl":"https://github.com/koala73/worldmonitor/blob/e586b8b4b80f595aa7ece295eec10d76f2921240/src/services/webmcp.ts#L786-L822","documentation":"SafeWebMcpError thrown by enforceOutputBudget in the browser WebMCP tool layer when a tool result, once JSON-serialized, exceeds the maximum allowed output size. It is a hard safety cap after any graceful truncation: oversized results are refused rather than shipped, and the generic message deliberately avoids echoing untrusted tool content.","triggerScenarios":"Thrown at src/services/webmcp.ts:303 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reduce the tool's requested scope/limit so the result fits the budget","Apply tool-specific truncation before the global budget check","Split large queries into narrower invocations"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e586b8b4b80f595aa7ece295eec10d76f2921240","analyzedAt":"2026-08-21T16:51:25.751Z","contentChangedAt":"2026-08-21T16:51:25.751Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}