waha_remove_group_participants
Remove participants from a WhatsApp group. This tool requires admin privileges and uses group ID and participant data to manage group membership.
Instructions
Remove member(s) from a group. Requires admin privileges.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| groupId | Yes | Group ID (format: number@g.us) | |
| participants | Yes | JSON array of participants to remove (format: [{'id': 'number@c.us'}, ...]) |
Implementation Reference
- src/index.ts:2167-2194 (handler)MCP tool handler that validates input, parses JSON participants array, calls WAHAClient.removeGroupParticipants(), and returns formatted success response with result.private async handleRemoveGroupParticipants(args: any) { const groupId = args.groupId; const participantsStr = args.participants; if (!groupId) { throw new Error("groupId is required"); } if (!participantsStr) { throw new Error("participants is required"); } const participants = JSON.parse(participantsStr); const result = await this.wahaClient.removeGroupParticipants({ groupId, participants, }); return { content: [ { type: "text", text: `Successfully removed ${participants.length} participant(s) from group ${groupId}.\n${JSON.stringify(result, null, 2)}`, }, ], }; }
- src/index.ts:717-733 (schema)Tool schema definition including input schema, properties for groupId and participants (as JSON string), and description.name: "waha_remove_group_participants", description: "Remove member(s) from a group. Requires admin privileges.", inputSchema: { type: "object", properties: { groupId: { type: "string", description: "Group ID (format: number@g.us)", }, participants: { type: "string", description: "JSON array of participants to remove (format: [{'id': 'number@c.us'}, ...])", }, }, required: ["groupId", "participants"], }, },
- src/index.ts:1113-1114 (registration)Registration in the MCP CallToolRequestHandler switch statement dispatching to the specific handler.case "waha_remove_group_participants": return await this.handleRemoveGroupParticipants(args);
- src/client/waha-client.ts:1009-1031 (helper)Underlying WAHAClient helper method that makes HTTP POST request to WAHA API endpoint to remove participants from group.async removeGroupParticipants(params: { groupId: string; participants: Array<{ id: string }>; }): Promise<any> { const { groupId, participants } = params; if (!groupId) { throw new WAHAError("groupId is required"); } if (!participants || participants.length === 0) { throw new WAHAError("participants array is required"); } const endpoint = `/api/${this.session}/groups/${encodeURIComponent(groupId)}/participants/remove`; const body = { participants }; return this.request<any>(endpoint, { method: "POST", body: JSON.stringify(body), }); }