googleapis/mcp-toolbox · error

too many filters provided: %d (maximum: %d)

Error message

too many filters provided: %d (maximum: %d)

What it means

Capacity guard in parseFilters: more filter entries were supplied than maxFilterLength allows, protecting the Firestore query from an unbounded WHERE clause.

Source

Thrown at internal/tools/firestore/firestorequerycollection/firestorequerycollection.go:359

	}

	// Parse analyze
	if analyze, ok := mapParams[analyzeQueryKey].(bool); ok {
		result.AnalyzeQuery = analyze
	}

	return result, nil
}

// parseFilters parses and validates filter configurations
func (t Tool) parseFilters(filtersRaw interface{}) ([]FilterConfig, error) {
	filters, ok := filtersRaw.([]any)
	if !ok {
		return nil, fmt.Errorf(errInvalidFilters, filtersKey)
	}

	if len(filters) > maxFilterLength {
		return nil, fmt.Errorf(errTooManyFilters, len(filters), maxFilterLength)
	}

	result := make([]FilterConfig, 0, len(filters))
	for i, filterRaw := range filters {
		filterJSON, ok := filterRaw.(string)
		if !ok {
			return nil, fmt.Errorf(errFilterNotString, i)
		}

		var filter FilterConfig
		if err := json.Unmarshal([]byte(filterJSON), &filter); err != nil {
			return nil, fmt.Errorf(errFilterParseFailed, i, err)
		}

		if err := filter.Validate(); err != nil {
			return nil, fmt.Errorf("filter at index %d is invalid: %w", i, err)
		}

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Reduce the filters array to at most the maximum count stated in the error
  2. Split the query into multiple invocations or narrow the collection path instead
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/tools/firestore/firestorequerycollection/firestorequerycollection.go:359 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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