Skip to main content
Glama
ExoCubeYT

OpenWA MCP Server

by ExoCubeYT

delete_session

Remove a WhatsApp session and its data permanently. Use this tool to clean up unused sessions and free resources.

Instructions

Permanently delete a WhatsApp session and its data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesID of the session to delete

Implementation Reference

  • The handler function for the 'delete_session' tool. Sends a DELETE request to /sessions/{sessionId} via openwaClient and returns the result as text.
    async ({ sessionId }) => {
      const data = await openwaClient({ method: "DELETE", path: `/sessions/${sessionId}` });
      return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
    }
  • Input schema for 'delete_session' defining the required 'sessionId' parameter (a string).
    description: "Permanently delete a WhatsApp session and its data",
    inputSchema: {
      sessionId: z.string().describe("ID of the session to delete"),
    },
  • Registration of the 'delete_session' tool on the McpServer via server.registerTool, including description, input schema, and handler.
    server.registerTool(
      "delete_session",
      {
        description: "Permanently delete a WhatsApp session and its data",
        inputSchema: {
          sessionId: z.string().describe("ID of the session to delete"),
        },
      },
      async ({ sessionId }) => {
        const data = await openwaClient({ method: "DELETE", path: `/sessions/${sessionId}` });
        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;
      } catch {
        return text as T;
      }
    }
  • src/index.ts:15-16 (registration)
    Registration of registerSessionTools on the McpServer in the main entry point.
    registerSessionTools(server);
    registerMessageTools(server);
Behavior3/5

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

No annotations provided, so description must cover behavioral traits. It indicates permanent deletion and data removal, which implies destructiveness and irreversibility. However, it lacks detail on side effects or authorization needs.

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, no fluff. Every word is necessary and contributes to understanding.

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

Completeness4/5

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

Given the tool's simplicity (one param, no output schema), the description is nearly complete. It lacks only minor context like prerequisites or alternative tool differentiation.

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% for the single parameter sessionId, with a clear description. The tool description adds no additional meaning beyond what is in the schema.

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 clearly states the action (delete), the resource (WhatsApp session), and the scope (permanently and its data). It distinguishes from sibling tools like create_session, stop_session, get_sessions.

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 vs alternatives like stop_session or any prerequisites. The description does not address whether the session should be stopped first or any other conditions.

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