googleapis/mcp-toolbox · error

failed to list subcollections of document %q: %w

Error message

failed to list subcollections of document %q: %w

What it means

Error "failed to list subcollections of document %q: %w" thrown in googleapis/mcp-toolbox.

Source

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

			docData["error"] = err.Error()
		} else {
			docData["success"] = true
		}

		results[i] = docData
	}
	return results, nil
}

func (s *Source) ListCollections(ctx context.Context, parentPath string) ([]any, error) {
	var collectionRefs []*firestore.CollectionRef
	var err error
	if parentPath != "" {
		// List subcollections of the specified document
		docRef := s.FirestoreClient().Doc(parentPath)
		collectionRefs, err = docRef.Collections(ctx).GetAll()
		if err != nil {
			return nil, fmt.Errorf("failed to list subcollections of document %q: %w", parentPath, err)
		}
	} else {
		// List root collections
		collectionRefs, err = s.FirestoreClient().Collections(ctx).GetAll()
		if err != nil {
			return nil, fmt.Errorf("failed to list root collections: %w", err)
		}
	}

	// Convert collection references to response data
	results := make([]any, len(collectionRefs))
	for i, collRef := range collectionRefs {
		collData := make(map[string]any)
		collData["id"] = collRef.ID
		collData["path"] = collRef.Path

		// If this is a subcollection, include parent information
		if collRef.Parent != nil {

View on GitHub (pinned to 8cc6e09de2)

When it happens

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