googleapis/mcp-toolbox · error · Error

HTTP error ${response.status}: ${errorBody}

Error message

HTTP error ${response.status}: ${errorBody}

What it means

An "arrayValue" must be a map containing a "values" key whose value is a JSON array ([]any). If either shape check fails, this error is returned. This mirrors Firestore's REST representation of arrays.

Source

Thrown at internal/server/static/js/runTool.js:107

                arguments: typedParams
            }
        };

        const mcpHeaders = { 
            ...headers, 
            'Content-Type': 'application/json',
            'MCP-Protocol-Version': '2025-11-25'
        };

        const response = await fetch(`/mcp`, {
            method: 'POST',
            headers: mcpHeaders,
            body: JSON.stringify(body)
        });

        if (!response.ok) {
            const errorBody = await response.text();
            throw new Error(`HTTP error ${response.status}: ${errorBody}`);
        }
        
        const results = await response.json();
        updateLastResults(results);
        displayResults(results, responseArea, prettifyCheckbox.checked);
    } catch (error) {
        console.error('Error running tool:', error);
        responseArea.value = `Error: ${error.message}`;
        updateLastResults(null);
    }
}

/**
 * Parses and validates a single array parameter from a raw string value.
 * @param {string} rawValue The raw string value from FormData.
 * @param {string} valueType The full array type string (e.g., "array<number>").
 * @param {string} paramName The name of the parameter for error messaging.
 * @return {!Array<*>} The parsed array.

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Wrap the elements: {"arrayValue": {"values": [<elements>]}}.
  2. Use the exact key name "values".
  3. Ensure "values" decodes as a JSON array, not a scalar or object.

Example fix

// before
{"arrayValue": [1, 2, 3]}
// after
{"arrayValue": {"values": [1, 2, 3]}}
Defensive patterns

Strategy: type-guard

Validate before calling

func validArrayValue(v any) bool {
    m, ok := v.(map[string]any); if !ok { return false }
    _, ok = m["values"].([]any); return ok
}

Type guard

func asArrayValue(v any) ([]any, bool) {
    m, ok := v.(map[string]any); if !ok { return nil, false }
    vals, ok := m["values"].([]any); return vals, ok
}

Try / catch

if _, err := JSONToFirestoreValue(val, client); err != nil {
    if strings.Contains(err.Error(), "invalid array value format") { /* wrap elements in {"values": [...]} */ }
}

Prevention

When it happens

Trigger: Passing {"arrayValue": [1,2,3]} (array directly, not wrapped), {"arrayValue": {"items": [...]}} (wrong key), or {"arrayValue": {"values": "abc"}} (values not an array).

Common situations: Developers hand-rolling Firestore JSON and omitting the "values" wrapper; configs migrated from a different serialization format.

Related errors


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/a9e84c5f682f75b2. Report an issue: GitHub.