Add visibility_level/include_subgroups filter arguments to Query.groups for list_groups MCP tool
Note
This is not an MCP tool issue itself — it's a small GraphQL API prerequisite for #607719 (list_groups MCP tool), found while redirecting that issue's implementation plan from an undecided REST/GraphQL question to the existing Query.groups query.
Problem Statement / Use Case
#607719 proposes two filters for list_groups: visibility (public/internal/private) and include_subgroups (recursively include descendant subgroups when parent_id is set). Both are already supported by GroupsFinder (app/finders/groups_finder.rb) — params[:visibility] and params[:include_parent_descendants] — but neither is exposed as an argument on Resolvers::Namespaces::BaseGroupsResolver (app/graphql/resolvers/namespaces/base_groups_resolver.rb), so Query.groups can't express either filter today.
Resolvers::ProjectsResolver already exposes the equivalent project-side filter (argument :visibility_level, ::Types::VisibilityLevelsEnum), so this isn't new API surface for the schema — just the same pattern, applied to groups.
Proposed Change
Add two arguments to Resolvers::Namespaces::BaseGroupsResolver, siblings to the existing top_level_only/parent_path arguments:
visibility_level(Types::VisibilityLevelsEnum, singular, matchingProjectsResolver's existing argument name and type) →GroupsFinder'sparams[:visibility].include_subgroups(GraphQL::Types::Boolean, defaultfalse) →GroupsFinder'sparams[:include_parent_descendants]. Only meaningful in combination withparent_path; a no-op otherwise, same as howGroupsFinderalready treatsinclude_parent_descendantswithout aparent.
Resources
app/graphql/resolvers/namespaces/base_groups_resolver.rb— add both arguments alongsidetop_level_only,parent_path,search.app/finders/groups_finder.rb(docstring at the top already documents both params) andapp/finders/concerns/namespaces/groups_filter.rb'sby_visibility/visibility_levels— the finder-side support already exists, this is purely exposing it.app/graphql/resolvers/projects_resolver.rb—argument :visibility_level, ::Types::VisibilityLevelsEnumis the precedent to copy for naming/type.app/graphql/types/visibility_levels_enum.rb— already public, reuse as the argument type.
Implementation Plan
- Add
argument :visibility_level, ::Types::VisibilityLevelsEnum, required: false, description: 'Filter groups by visibility level.'toBaseGroupsResolver, and pass it through asparams[:visibility]inresolve_groups. - Add
argument :include_subgroups, GraphQL::Types::Boolean, required: false, default_value: false, description: 'Include descendant subgroups when filtering by parent_path.', passed through asparams[:include_parent_descendants]. - Specs: resolver spec covering
visibility_levelfiltering andinclude_subgroupscombined withparent_path(including the no-op case whenparent_pathis absent), andspec/graphql/all_queries_spec.rbcoverage once#607719commits its.graphqlfile using the new arguments.