list_groups
Retrieve all WhatsApp groups from an Evolution API instance, with option to include participant details for group management.
Instructions
List all groups
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| getParticipants | No | Include participants list | |
| instanceName | Yes | Instance name |
Implementation Reference
- src/index.ts:898-908 (handler)The asynchronous handler function for the 'list_groups' MCP tool. It extracts instanceName and getParticipants from args, calls evolutionAPI.findGroups, and returns the result formatted as MCP text content.private async handleListGroups(args: any) { const groups = await evolutionAPI.findGroups(args.instanceName, args.getParticipants); return { content: [ { type: 'text', text: JSON.stringify(groups, null, 2) } ] }; }
- src/index.ts:354-364 (schema)Schema definition and registration for the 'list_groups' tool in the tools array provided to the MCP ListToolsRequestHandler.{ name: 'list_groups', description: 'List all groups', inputSchema: { type: 'object', properties: { instanceName: { type: 'string', description: 'Instance name' }, getParticipants: { type: 'boolean', description: 'Include participants list' } }, required: ['instanceName'] }
- src/index.ts:532-533 (registration)Switch case in the MCP CallToolRequestHandler that dispatches 'list_groups' tool calls to the specific handler method.case 'list_groups': return await this.handleListGroups(args);
- Supporting utility in EvolutionAPI service that makes the HTTP GET request to the backend /group/findGroups endpoint to retrieve the list of groups, invoked by the tool handler.async findGroups(instanceName: string, getParticipants?: boolean): Promise<Group[]> { const response = await this.client.get(`/group/findGroups/${instanceName}`, { params: { getParticipants } }); return response.data; }