Josh,
AFAIK the function should not use $context. Filling $context with information is IMO a Controller task. I'd prefer to use an internal variable e.g. $membergroups and return that var. Please see https://github.com/elkarte/Elkarte/wiki/Architecture

Please keep in mind: there are many different cases, where certain groups need to be exculded (e.g. admin/local moderators / protected groups / hidden groups ...) from the list or you just want to pick some specific groups. There's already a function which covers most cases: getBasicMembergroupData()