Skip to main content
Glama

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
NameRequiredDescriptionDefault
groupIdYesGroup ID (format: number@g.us)
participantsYesJSON array of participants to remove (format: [{'id': 'number@c.us'}, ...])

Implementation Reference

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

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