koala73/worldmonitor · error · SafeWebMcpError

Dashboard action result exceeded the safe output limit.

Error message

Dashboard action result exceeded the safe output limit.

What it means

The WebMCP dashboard-action result sanitizer detected that the serialized action result exceeds the safe output limit even after bounding each text field (message 240 chars, target fields 96/64 chars). This is a size guard on the MCP tool response: the action produced an unexpectedly large payload (typically too many targets) and the bounded envelope would still be too big to return.

Source

Thrown at src/services/webmcp.ts:620

} {
  const targets = (Array.isArray(result.targets) ? result.targets : []).map((target) => ({
    target: boundedText(target?.target, 96),
    status: target?.status,
    ...(target?.reason ? { reason: boundedText(target.reason, 64) } : {}),
  }));
  const bounded = {
    ok: result.ok === true,
    status: result.status,
    ...(result.actionType ? { actionType: result.actionType } : {}),
    ...(result.reason ? { reason: boundedText(result.reason, 64) } : {}),
    message: boundedText(result.message, 240),
    targets,
    targetCount: targets.length,
    targetsTruncated: false,
  };

  if (JSON.stringify(bounded).length > MAX_OUTPUT_CHARS) {
    throw new SafeWebMcpError('Dashboard action result exceeded the safe output limit.');
  }
  return bounded;
}

function boundDashboardSearchResult(result: DashboardSearchResponse): DashboardSearchResponse {
  const sourceResults = Array.isArray(result.results) ? result.results : [];
  const results = sourceResults
    .filter((match) => typeof match?.key === 'string' && SEARCH_RESULT_KEY.test(match.key))
    .slice(0, MAX_SEARCH_RESULTS)
    .map((match) => ({
      key: match.key,
      type: boundedText(match?.type, DASHBOARD_SEARCH_TYPE_MAX_CHARS),
      title: boundedText(match?.title, DASHBOARD_SEARCH_TITLE_MAX_CHARS),
      ...(match?.subtitle ? {
        subtitle: boundedText(match.subtitle, DASHBOARD_SEARCH_SUBTITLE_MAX_CHARS),
      } : {}),
      executable: match?.executable === true,
    }));

View on GitHub (pinned to a96956387a)

Solutions

  1. Reduce the action's output size at the source (fewer targets, shorter messages) before serialization
  2. Trim the targets array and set targetsTruncated to fit the limit instead of failing
  3. Add a unit test asserting the bounded envelope stays under the limit for worst-case inputs
Defensive patterns

Strategy: fallback

When it happens

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

Common situations: See trigger scenarios.


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