googleapis/mcp-toolbox · error

failed to list collections: %w

Error message

failed to list collections: %w

What it means

Error "failed to list collections: %w" thrown in googleapis/mcp-toolbox.

Source

Thrown at internal/sources/firestore/firestore.go:624

	Types []string `json:"types"`
}

// CollectionSchema represents metadata for a Firestore collection
type CollectionSchema struct {
	Collection string        `json:"collection"`
	Fields     []FieldSchema `json:"fields"`
}

// GetSchema returns schema information for the specified collection or all root collections.
func (s *Source) GetSchema(ctx context.Context, collection string) (any, error) {
	var collectionsToInspect []string
	if collection != "" {
		collectionsToInspect = []string{collection}
	} else {
		// Discover root collections
		collRefs, err := s.FirestoreClient().Collections(ctx).GetAll()
		if err != nil {
			return nil, fmt.Errorf("failed to list collections: %w", err)
		}
		for _, ref := range collRefs {
			collectionsToInspect = append(collectionsToInspect, ref.ID)
		}
	}

	result := make([]CollectionSchema, 0, len(collectionsToInspect))
	for _, collName := range collectionsToInspect {
		schema, err := s.getSchemaFromPipeline(ctx, collName)
		if err == nil && len(schema.Fields) > 0 {
			result = append(result, schema)
			continue
		}

		// Fallback: sample documents directly if get_schema pipeline stage is not available
		collRef := s.FirestoreClient().Collection(collName)
		docs, err := collRef.Limit(50).Documents(ctx).GetAll()
		if err != nil {

View on GitHub (pinned to 8cc6e09de2)

When it happens

Trigger: Thrown at internal/sources/firestore/firestore.go:624 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/e276f33ed2381763. Report an issue: GitHub.