list_group_members
Retrieve all members of a GitLab group, including inherited members, by specifying group ID, pagination, and optional search query for precise results.
Instructions
List all members of a GitLab group (including inherited members)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| group_id | No | ||
| page | No | ||
| per_page | No | ||
| query | No |
Implementation Reference
- src/index.ts:680-685 (handler)MCP server tool handler for 'list_group_members': parses arguments using schema, calls gitlabApi.listGroupMembers, formats and returns the response.case "list_group_members": { const args = ListGroupMembersSchema.parse(request.params.arguments); const { group_id, ...options } = args; const members = await gitlabApi.listGroupMembers(group_id, options); return formatMembersResponse(members); }
- src/schemas.ts:606-611 (schema)Zod schema defining input parameters for the list_group_members tool: group_id (required), optional query, page, per_page.export const ListGroupMembersSchema = z.object({ group_id: z.string(), query: z.string().optional(), page: z.number().optional(), per_page: z.number().optional(), });
- src/index.ts:274-277 (registration)Tool registration in ALL_TOOLS array, specifying name, description, input schema, and read-only flag.name: "list_group_members", description: "List all members of a GitLab group (including inherited members)", inputSchema: createJsonSchema(ListGroupMembersSchema), readOnly: true
- src/gitlab-api.ts:1415-1454 (helper)GitLabApi class method implementing the API call to fetch group members, constructs URL, adds params, fetches, parses response with schema.async listGroupMembers( groupId: string, options: { query?: string; page?: number; per_page?: number; } = {} ): Promise<GitLabMembersResponse> { const url = new URL( `${this.apiUrl}/groups/${encodeURIComponent(groupId)}/members/all` ); // Add query parameters Object.entries(options).forEach(([key, value]) => { if (value !== undefined) { url.searchParams.append(key, value.toString()); } }); const response = await fetch(url.toString(), { headers: { "Authorization": `Bearer ${this.token}` } }); if (!response.ok) { throw new McpError( ErrorCode.InternalError, `GitLab API error: ${response.statusText}` ); } const data = await response.json(); const totalCount = parseInt(response.headers.get("X-Total") || "0"); return GitLabMembersResponseSchema.parse({ count: totalCount, items: data }); }