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);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Leave') which implies a mutation, but doesn't disclose any behavioral traits: no mention of permissions required, whether the action is reversible, rate limits, error conditions, or what happens upon success. This leaves critical gaps for an agent to understand the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise at just three words, front-loading the core action and resource with zero wasted words. Every element earns its place, making it immediately scannable and efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't address what happens after leaving (success indicators, error responses), doesn't mention side effects, and provides no behavioral context. The agent would be left guessing about important aspects of tool usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the single parameter 'groupId' fully documented in the schema itself. The description adds no additional parameter semantics beyond what's already in the schema, so it meets the baseline of 3 where the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Leave') and resource ('a group'), making the purpose immediately understandable. It distinguishes itself from siblings like 'waha_remove_group_participants' (which removes others) and 'waha_join_group' (the opposite action), though this differentiation isn't explicitly stated in the description itself.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing to be a member first), consequences (e.g., losing access to group messages), or when to choose this over similar tools like 'waha_remove_group_participants' for self-removal scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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-whatsapp-mcp'

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