waha_leave_group
Exit a WhatsApp group by providing the group ID, enabling chat management through the WAHA MCP Server.
Instructions
Leave a group.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| groupId | Yes | Group ID to leave (format: number@g.us) |
Implementation Reference
- src/index.ts:2091-2108 (handler)MCP tool handler for waha_leave_group. Extracts groupId from args, validates it, calls wahaClient.leaveGroup(groupId), and returns success message.private async handleLeaveGroup(args: any) { const groupId = args.groupId; if (!groupId) { throw new Error("groupId is required"); } await this.wahaClient.leaveGroup(groupId); return { content: [ { type: "text", text: `Successfully left group ${groupId}.`, }, ], }; }
- src/index.ts:670-683 (registration)Tool registration in ListTools response, including name, description, and input schema.{ name: "waha_leave_group", description: "Leave a group.", inputSchema: { type: "object", properties: { groupId: { type: "string", description: "Group ID to leave (format: number@g.us)", }, }, required: ["groupId"], }, },
- src/client/waha-client.ts:949-959 (handler)WAHAClient method implementing the core leave group API call via POST to /api/{session}/groups/{groupId}/leave.async leaveGroup(groupId: string): Promise<void> { if (!groupId) { throw new WAHAError("groupId is required"); } const endpoint = `/api/${this.session}/groups/${encodeURIComponent(groupId)}/leave`; await this.request<void>(endpoint, { method: "POST", }); }
- src/index.ts:1107-1108 (registration)Switch case dispatcher in CallToolRequestSchema handler that routes to the specific tool handler.case "waha_leave_group": return await this.handleLeaveGroup(args);