koala73/worldmonitor · error · SafeWebMcpError

Tool output exceeded the safe output limit.

Error message

Tool output exceeded the safe output limit.

What it means

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.

Solutions

  1. Reduce the tool's requested scope/limit so the result fits the budget
  2. Apply tool-specific truncation before the global budget check
  3. Split large queries into narrower invocations
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/services/webmcp.ts:303 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of koala73/worldmonitor@e586b8b4b8 (2026-08-21). Data as JSON: /api/errors/3304a668eded8040. Report an issue: GitHub.

Appendix: source

Thrown at src/services/webmcp.ts:804

      tool: name,
      targetCancellationSupported: Boolean(signal),
    });
    try {
      throwIfWebMcpAborted(signal);
      const preflightResult = await hooks.preflight?.(args, execution);
      throwIfWebMcpAborted(signal);
      let result: unknown;
      if (preflightResult !== undefined) {
        result = preflightResult;
      } else if (CANCELLATION_REQUIRED_WEBMCP_TOOLS.has(name) && !signal) {
        // This tool declared that a phantom completion would be unsafe, and
        // the host cannot deliver the target-side signal. Return a structured
        // denial because some hosts erase the name and message of errors
        // raised by the page callback.
        result = unsupportedCancellationResult();
      } else {
        result = await fn(args, execution);
        // Browser cancellation rejects executeTool independently of this
        // callback. Re-check here so late work cannot publish success telemetry
        // after the host has already cancelled the invocation.
        throwIfWebMcpAborted(signal);
      }
      enforceOutputBudget(result);
      const invocation = classifyInvocationResult(result);
      reportWebMcpEvent(trackEvent, 'webmcp-tool-invoked', {
        tool: name,
        ...invocation,
        ...(hooks.successMetadata?.(args, result) ?? {}),
      });
      return result;
    } catch (error) {
      const reason = signal?.aborted
        ? 'cancelled'
        : classifyInvocationError(error);
      reportWebMcpEvent(trackEvent, 'webmcp-tool-invoked', {
        tool: name,

View on GitHub (pinned to e586b8b4b8)