Skip to main content
Glama
ExoCubeYT

OpenWA MCP Server

by ExoCubeYT

create_session

Create a new WhatsApp session by providing a unique name. The session enables independent message management.

Instructions

Create a new WhatsApp session with the given name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesUnique name for the new session

Implementation Reference

  • The handler function that executes the create_session tool logic - it destructures `name` from the input, calls openwaClient with POST /sessions, and returns the result.
      async ({ name }) => {
        const data = await openwaClient({ method: "POST", path: "/sessions", body: { name } });
        return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
      }
    );
  • The input schema for create_session - expects a single `name` parameter (zod string).
    inputSchema: {
      name: z.string().describe("Unique name for the new session"),
    },
  • Registration of the create_session tool via server.registerTool with name, schema, and handler.
    server.registerTool(
      "create_session",
      {
        description: "Create a new WhatsApp session with the given name",
        inputSchema: {
          name: z.string().describe("Unique name for the new session"),
        },
      },
      async ({ name }) => {
        const data = await openwaClient({ method: "POST", path: "/sessions", body: { name } });
        return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
      }
    );
  • src/index.ts:4-16 (registration)
    Import of the registerSessionTools registration function.
    import { registerSessionTools } from "./tools/sessions.js";
    import { registerMessageTools } from "./tools/messages.js";
    import { registerBulkTools } from "./tools/bulk.js";
    import { registerGroupTools } from "./tools/groups.js";
    import { registerContactTools } from "./tools/contacts.js";
    import { registerWebhookTools } from "./tools/webhooks.js";
    import { registerLabelTools } from "./tools/labels.js";
    import { registerMediaTools } from "./tools/media.js";
    
    const server = new McpServer({ name: "openwa-mcp", version: "1.0.0" });
    
    registerSessionTools(server);
    registerMessageTools(server);
  • The openwaClient helper used by create_session 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;
      }
    }
Behavior2/5

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

The description is very brief and does not disclose any behavioral traits beyond the basic creation action. No information about side effects, permissions, or error conditions is provided, and there are no annotations to supplement.

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

Conciseness4/5

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

The description is a single sentence that directly states the tool's purpose. It is concise but lacks additional structure or detail that might help the agent, though it is not verbose.

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?

Given the existence of sibling tools like 'start_session' and 'delete_session', the description does not provide enough context to differentiate usage. No output schema exists, and return values are not mentioned.

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 for the single parameter 'name', which is described as 'Unique name for the new session' in the schema. The description adds no additional meaning beyond that.

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 explicitly states 'Create a new WhatsApp session with the given name', clearly indicating the verb and resource. However, it does not differentiate from the sibling 'start_session' tool, which could cause confusion.

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 is provided on when to use this tool over alternatives like 'start_session' or 'delete_session'. No exclusions or context are given.

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