waha_get_group_participants
Retrieve a list of all members in a WhatsApp group using the group ID to manage group participants and interactions.
Instructions
List all members in a group.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| groupId | Yes | Group ID (format: number@g.us) |
Implementation Reference
- src/index.ts:2113-2130 (handler)The handler function that implements the core logic for the 'waha_get_group_participants' MCP tool. It extracts the groupId from arguments, validates it, calls the WAHA client to fetch participants, formats the response as JSON, and returns it in the MCP format.private async handleGetGroupParticipants(args: any) { const groupId = args.groupId; if (!groupId) { throw new Error("groupId is required"); } const participants = await this.wahaClient.getGroupParticipants(groupId); return { content: [ { type: "text", text: `Group ${groupId} participants (${participants.length}):\n${JSON.stringify(participants, null, 2)}`, }, ], }; }
- src/index.ts:685-696 (registration)Tool registration in the ListTools handler. Defines the tool name, description, and input schema requiring a 'groupId' parameter.name: "waha_get_group_participants", description: "List all members in a group.", inputSchema: { type: "object", properties: { groupId: { type: "string", description: "Group ID (format: number@g.us)", }, }, required: ["groupId"], },
- src/index.ts:688-696 (schema)Input schema definition for the tool, specifying the required 'groupId' string parameter.type: "object", properties: { groupId: { type: "string", description: "Group ID (format: number@g.us)", }, }, required: ["groupId"], },
- src/client/waha-client.ts:965-975 (helper)WAHAClient helper method that performs the actual HTTP GET request to the WAHA API endpoint for retrieving group participants.async getGroupParticipants(groupId: string): Promise<any[]> { if (!groupId) { throw new WAHAError("groupId is required"); } const endpoint = `/api/${this.session}/groups/${encodeURIComponent(groupId)}/participants`; return this.request<any[]>(endpoint, { method: "GET", }); }
- src/index.ts:1109-1110 (registration)Dispatch in the CallToolRequestSchema switch statement that routes calls to the specific handler.case "waha_get_group_participants": return await this.handleGetGroupParticipants(args);