Skip to main content
Glama
luiso2

Evolution API WhatsApp MCP Server

by luiso2

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
NameRequiredDescriptionDefault
getParticipantsNoInclude participants list
instanceNameYesInstance name

Implementation Reference

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

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

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