googleapis/mcp-toolbox · error

this is not a read-only pipeline: %+v

Error message

this is not a read-only pipeline: %+v

What it means

Error "this is not a read-only pipeline: %+v" thrown in googleapis/mcp-toolbox.

Source

Thrown at internal/sources/mongodb/mongodb.go:135

		}
		final = append(final, tmp2)
	}
	return final, err
}

func (s *Source) Aggregate(ctx context.Context, pipelineString string, canonical, readOnly bool, database, collection string) ([]any, error) {
	var pipeline = []bson.M{}
	err := bson.UnmarshalExtJSON([]byte(pipelineString), canonical, &pipeline)
	if err != nil {
		return nil, err
	}

	if readOnly {
		//fail if we do a merge or an out
		for _, stage := range pipeline {
			for key := range stage {
				if key == "$merge" || key == "$out" {
					return nil, fmt.Errorf("this is not a read-only pipeline: %+v", stage)
				}
			}
		}
	}

	cur, err := s.MongoClient().Database(database).Collection(collection).Aggregate(ctx, pipeline)
	if err != nil {
		return nil, err
	}
	defer cur.Close(ctx)
	res, err := parseData(ctx, cur)
	if err != nil {
		return nil, err
	}
	if res == nil {
		return []any{}, nil
	}
	return res, err

View on GitHub (pinned to 8cc6e09de2)

When it happens

Trigger: Thrown at internal/sources/mongodb/mongodb.go:135 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/49e88382fdb1983e. Report an issue: GitHub.