Skip to main content
Glama

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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'}`);
        }
      }
    );
  • 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;
    }
  • 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;
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/avisekrath/zulip-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server