get-user-groups
Retrieve all user groups within a Zulip organization to manage permissions and organize team members effectively.
Instructions
Get all user groups in the organization.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server.ts:934-955 (handler)Registration and handler function for the 'get-user-groups' tool. This defines the tool, its description, empty input schema, and the execution logic that fetches user groups via ZulipClient and formats the response.server.tool( "get-user-groups", "Get all user groups in the organization.", {}, async () => { try { const result = await zulipClient.getUserGroups(); return createSuccessResponse(JSON.stringify({ group_count: result.user_groups.length, user_groups: result.user_groups.map(group => ({ id: group.id, name: group.name, description: group.description, member_count: group.members.length, is_system_group: group.is_system_group })) }, null, 2)); } catch (error) { return createErrorResponse(`Error getting user groups: ${error instanceof Error ? error.message : 'Unknown error'}`); } } );
- src/zulip/client.ts:442-445 (helper)Helper method in ZulipClient that makes the HTTP GET request to Zulip API endpoint '/user_groups' to retrieve all user groups.async getUserGroups(): Promise<{ user_groups: ZulipUserGroup[] }> { const response = await this.client.get('/user_groups'); return response.data; }
- src/types.ts:77-86 (schema)TypeScript interface defining the structure of Zulip user groups used in the tool's response.export interface ZulipUserGroup { id: number; name: string; description: string; members: number[]; direct_subgroup_ids: number[]; is_system_group: boolean; can_manage_group: number; can_mention_group: number; }