Skip to main content
Glama
ExoCubeYT

OpenWA MCP Server

by ExoCubeYT

leave_group

Leaves a specific WhatsApp group when provided with the session ID and group ID.

Instructions

Leave a WhatsApp group

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesSession ID
groupIdYesGroup ID to leave

Implementation Reference

  • The handler function for the 'leave_group' tool. Calls openwaClient with POST method to `/sessions/{sessionId}/groups/{groupId}/leave`.
    async ({ sessionId, groupId }) => {
      const data = await openwaClient({
        method: "POST",
        path: `/sessions/${sessionId}/groups/${groupId}/leave`,
      });
      return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
    }
  • The tool registration and input schema for 'leave_group'. Requires sessionId (string) and groupId (string) parameters.
    server.registerTool(
      "leave_group",
      {
        description: "Leave a WhatsApp group",
        inputSchema: {
          sessionId: z.string().describe("Session ID"),
          groupId: z.string().describe("Group ID to leave"),
        },
      },
  • src/index.ts:18-18 (registration)
    Registration of all group tools (including leave_group) via registerGroupTools(server) call in the main entry point.
    registerGroupTools(server);
  • The full server.registerTool call for 'leave_group', which both registers and defines the tool.
    server.registerTool(
      "leave_group",
      {
        description: "Leave a WhatsApp group",
        inputSchema: {
          sessionId: z.string().describe("Session ID"),
          groupId: z.string().describe("Group ID to leave"),
        },
      },
      async ({ sessionId, groupId }) => {
        const data = await openwaClient({
          method: "POST",
          path: `/sessions/${sessionId}/groups/${groupId}/leave`,
        });
        return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
      }
    );
  • The openwaClient helper function used by the handler to make HTTP requests to the OpenWA API.
    export async function openwaClient<T = unknown>(opts: RequestOptions): Promise<T> {
      const url = `${BASE_URL}${opts.path}`;
    
      const headers: Record<string, string> = {
        "Content-Type": "application/json",
        "X-API-Key": API_KEY,
      };
    
      const res = await fetch(url, {
        method: opts.method,
        headers,
        body: opts.body ? JSON.stringify(opts.body) : undefined,
      });
    
      const text = await res.text();
    
      if (!res.ok) {
        throw new Error(`OpenWA API ${res.status}: ${text}`);
      }
    
      try {
        return JSON.parse(text) as T;
Behavior2/5

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

No annotations are provided, so the description must disclose behavioral traits. It only states the action but does not explain consequences (e.g., losing access, potential loss of chat history, or that it cannot be undone). For a mutation operation, this is insufficient.

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?

Single sentence with no unnecessary words. Perfectly concise and front-loaded.

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

Completeness3/5

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

With low complexity (2 simple params, no output schema), the description is adequate for the basic action but lacks behavioral context (e.g., what happens after leaving, any confirmation needed). Could mention that leaving is permanent without re-invitation.

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?

Schema coverage is 100% with both parameters documented (sessionId and groupId). The description adds no additional meaning beyond what the schema provides. Baseline 3 applies since schema does the heavy lifting.

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

Purpose5/5

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

The description 'Leave a WhatsApp group' clearly states the action (verb 'leave') and the resource ('WhatsApp group'). It distinguishes from sibling tools like remove_group_member (which removes others) and demote_member (which changes roles).

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?

No guidance on when to use this tool versus alternatives (e.g., remove_group_member for removing others, or deleting the group itself). No prerequisites or constraints mentioned, such as requiring membership or irreversible nature.

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/ExoCubeYT/openwa-mcp'

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