Skip to main content
Glama

waha_get_groups

Retrieve WhatsApp group lists with customizable filtering, sorting, and pagination options for efficient chat management.

Instructions

List all groups with filtering and pagination options.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sortByNoSort field (default: id)
sortOrderNoSort order (default: asc)
limitNoLimit results (default: 100, max: 100)
offsetNoOffset for pagination
excludeNoExclude fields like 'participants'

Implementation Reference

  • The handler function that implements the core logic of the 'waha_get_groups' tool. It parses arguments, calls the WAHAClient.getGroups method, and returns a formatted text response with the list of groups as JSON.
    private async handleGetGroups(args: any) {
      const groups = await this.wahaClient.getGroups({
        sortBy: args.sortBy,
        sortOrder: args.sortOrder,
        limit: args.limit,
        offset: args.offset,
        exclude: args.exclude,
      });
    
      return {
        content: [
          {
            type: "text",
            text: `Found ${groups.length} group(s):\n${JSON.stringify(groups, null, 2)}`,
          },
        ],
      };
    }
  • src/index.ts:516-546 (registration)
    Tool registration in the ListToolsRequestSchema handler, including name, description, and input schema definition for validation.
      name: "waha_get_groups",
      description: "List all groups with filtering and pagination options.",
      inputSchema: {
        type: "object",
        properties: {
          sortBy: {
            type: "string",
            enum: ["id", "name"],
            description: "Sort field (default: id)",
          },
          sortOrder: {
            type: "string",
            enum: ["asc", "desc"],
            description: "Sort order (default: asc)",
          },
          limit: {
            type: "number",
            description: "Limit results (default: 100, max: 100)",
          },
          offset: {
            type: "number",
            description: "Offset for pagination",
          },
          exclude: {
            type: "array",
            items: { type: "string" },
            description: "Exclude fields like 'participants'",
          },
        },
      },
    },
  • Supporting method in WAHAClient that performs the actual HTTP GET request to the WAHA API endpoint /api/{session}/groups with query parameters for sorting, pagination, and filtering.
    async getGroups(params?: {
      sortBy?: "id" | "name";
      sortOrder?: "asc" | "desc";
      limit?: number;
      offset?: number;
      exclude?: string[];
    }): Promise<any[]> {
      const queryParams: Record<string, any> = {};
    
      if (params?.sortBy) queryParams.sortBy = params.sortBy;
      if (params?.sortOrder) queryParams.sortOrder = params.sortOrder;
      if (params?.limit) queryParams.limit = Math.min(params.limit, 100);
      if (params?.offset) queryParams.offset = params.offset;
      if (params?.exclude) queryParams.exclude = params.exclude;
    
      const queryString = this.buildQueryString(queryParams);
      const endpoint = `/api/${this.session}/groups${queryString}`;
    
      return this.request<any[]>(endpoint, {
        method: "GET",
      });
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It mentions 'filtering and pagination options' but doesn't disclose key behaviors: whether this is a read-only operation, if it requires authentication, rate limits, or what the output format looks like (e.g., list of objects with fields). For a tool with 5 parameters and no output schema, this leaves significant gaps in understanding how it behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action ('List all groups') and adds essential qualifiers ('with filtering and pagination options'). There's zero waste—every word contributes to understanding the tool's scope without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (5 parameters, no annotations, no output schema), the description is incomplete. It doesn't address behavioral aspects like safety (read-only vs. destructive), authentication needs, or output structure, which are critical for an agent to use it correctly. While concise, it lacks the depth needed for a tool with multiple options and no structured output documentation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so parameters are fully documented in the schema. The description adds minimal value beyond implying filtering (via 'exclude' parameter) and pagination (via 'limit'/'offset'), but doesn't explain semantics like what 'exclude' fields are available or default behaviors. Baseline 3 is appropriate since the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List all groups') and resource ('groups'), making the purpose immediately understandable. It distinguishes from siblings like 'waha_get_group_info' (single group details) and 'waha_get_groups_count' (count only) by emphasizing comprehensive listing with filtering/pagination. However, it doesn't explicitly contrast with 'waha_get_chats' which might also list group chats, leaving minor ambiguity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when filtering/pagination is needed, nor does it reference sibling tools like 'waha_get_group_info' for single group details or 'waha_get_groups_count' for just a count. Without this context, an agent might misuse it for simpler tasks.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/seejux/waha-whatsapp-mcp'

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