Skip to main content
Glama
billyfranklim1

mcp-evolution

List Groups

list_groups

List WhatsApp groups from a pinned instance. Filter by case-insensitive subject search and set a limit to control payload size.

Instructions

List WhatsApp groups for the pinned instance. Supports search and limit to prevent large payloads.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
searchNoCase-insensitive substring match against group subject. Omit for no filter.
limitNoMax results to return (default 50, max 500).

Implementation Reference

  • Registers the 'list_groups' tool handler: calls Evolution API to fetch all groups, optionally filters by subject (case-insensitive), sorts alphabetically, limits results, and normalizes output.
    export function registerListGroups(server: McpServer, client: EvolutionClient): void {
      server.registerTool(
        "list_groups",
        {
          title: "List Groups",
          description: "List WhatsApp groups for the pinned instance. Supports search and limit to prevent large payloads.",
          inputSchema: schema,
        },
        async (args) => {
          try {
            const data = await client.get<GroupItem[]>(
              `/group/fetchAllGroups/${client.instanceName}?getParticipants=false`
            );
    
            let groups = Array.isArray(data) ? data : [];
    
            // Client-side search filter (Evolution API has no query filter)
            if (args.search) {
              const needle = args.search.toLowerCase();
              groups = groups.filter((g) => g.subject?.toLowerCase().includes(needle));
            }
    
            // Sort by subject asc for stable results
            groups.sort((a, b) => (a.subject ?? "").localeCompare(b.subject ?? ""));
    
            // Cap results
            const limit = args.limit ?? 50;
            groups = groups.slice(0, limit);
    
            // Normalize to compact shape — drop owner to shrink payload
            const normalized = groups.map(({ id, subject, size }) => ({ id, subject, size }));
    
            return {
              content: [{ type: "text" as const, text: JSON.stringify(normalized, null, 2) }],
            };
          } catch (e) {
            if (e instanceof McpError) {
              return { isError: true, content: [{ type: "text" as const, text: e.message }] };
            }
            throw e;
          }
        }
      );
    }
  • Zod schema defining optional 'search' (string) and optional 'limit' (int 1-500, default 50) input parameters.
    const schema = {
      search: z
        .string()
        .optional()
        .describe("Case-insensitive substring match against group subject. Omit for no filter."),
      limit: z
        .number()
        .int()
        .min(1)
        .max(500)
        .default(50)
        .optional()
        .describe("Max results to return (default 50, max 500)."),
    };
  • TypeScript interface for raw group items returned by the Evolution API.
    interface GroupItem {
      id: string;
      subject: string;
      size?: number;
      owner?: string;
    }
  • Calls registerListGroups inside registerAllTools, wiring the tool into the MCP server.
    registerListGroups(server, client);
Behavior3/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 listing groups and preventing large payloads, but lacks details on permissions, output format, or side effects. Basic behavior is clear but incomplete.

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 concise sentence that front-loads the main purpose. No unnecessary words.

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

Completeness3/5

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

For a simple list operation, the description is adequate but omits what the response contains (e.g., list of group objects or just IDs). No output schema is provided, so the agent lacks important context about return values.

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

Parameters4/5

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

The input schema covers both parameters with good descriptions. The description adds value by explaining the purpose of limit (prevent large payloads) and specifying case-insensitive substring match for search, which is not in the schema.

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

Purpose5/5

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

The description clearly states it lists WhatsApp groups for the pinned instance, with search and limit options. This distinguishes it from sibling tools that create or modify groups.

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

Usage Guidelines4/5

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

The description implies use for listing with filtering and pagination, but does not explicitly state when to avoid or compare with alternatives like get_group_info.

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/billyfranklim1/mcp-evolution'

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