Skip to main content
Glama

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
NameRequiredDescriptionDefault
groupIdYesGroup ID to leave (format: number@g.us)

Implementation Reference

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

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/seejux/waha-mcp'

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