koala73/worldmonitor · error · SafeWebMcpError

query must be at most ${MAX_SEARCH_QUERY_CHARS} characters.

Error message

query must be at most ${MAX_SEARCH_QUERY_CHARS} characters.

What it means

A SafeWebMcpError of kind 'validation' thrown by the search_dashboard WebMCP tool when the query argument exceeds MAX_SEARCH_QUERY_CHARS characters. It fires after confirming query is a string but before executing the search, rejecting oversized inputs that would waste tokens or degrade search performance. It is a generic input-length validation guard; the input at fault is an overly long query string. Callers must shorten the query below the maximum length and retry.

Source

Thrown at src/services/webmcp.ts:2465

            default: DEFAULT_SEARCH_RESULTS,
          },
        },
        required: ['query'],
        additionalProperties: false,
      },
      annotations: { readOnlyHint: true, untrustedContentHint: true },
      execute: withInvocationLogging(WEBMCP_SPA_TOOL.searchDashboard, async (args, extra) => {
        if (!hasOnlyOwnKeys(args, ['query', 'scope', 'limit'])) {
          throw new SafeWebMcpError(
            'search_dashboard accepts only query, scope, and limit.',
            'validation',
          );
        }
        if (typeof args.query !== 'string') {
          throw new SafeWebMcpError('query must be a string.', 'validation');
        }
        if (args.query.length > MAX_SEARCH_QUERY_CHARS) {
          throw new SafeWebMcpError(
            `query must be at most ${MAX_SEARCH_QUERY_CHARS} characters.`,
            'validation',
          );
        }
        const query = args.query.trim();
        if (!query) throw new SafeWebMcpError('query must not be empty.', 'validation');

        const scope = args.scope === undefined ? 'all' : args.scope;
        if (typeof scope !== 'string' || !DASHBOARD_SEARCH_SCOPES.has(scope as DashboardSearchScope)) {
          throw new SafeWebMcpError(
            'scope must be one of: all, signals, map, panels, actions.',
            'validation',
          );
        }
        const limit = args.limit === undefined ? DEFAULT_SEARCH_RESULTS : args.limit;
        if (!Number.isInteger(limit) || Number(limit) < 1 || Number(limit) > MAX_SEARCH_RESULTS) {
          throw new SafeWebMcpError(
            `limit must be an integer from 1 to ${MAX_SEARCH_RESULTS}.`,

View on GitHub (pinned to 9361220cc0)

Solutions

  1. Shorten the query to within the stated character limit
  2. Use more specific search terms instead of pasting large text
Defensive patterns

Strategy: validation

When it happens

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

Common situations: See trigger scenarios.


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