Skip to main content
Glama
ExoCubeYT

OpenWA MCP Server

by ExoCubeYT

get_sessions

Retrieve all active WhatsApp sessions to manage and monitor your connected messaging accounts.

Instructions

List all WhatsApp sessions currently managed by OpenWA

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The async handler function for the 'get_sessions' tool. It calls the OpenWA API GET /sessions endpoint and returns the list of all WhatsApp sessions as formatted JSON text.
    async () => {
      const data = await openwaClient({ method: "GET", path: "/sessions" });
      return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
    }
  • The input schema definition for 'get_sessions'. It has an empty object (no inputs required) and a description explaining the tool lists all WhatsApp sessions.
    {
      description: "List all WhatsApp sessions currently managed by OpenWA",
      inputSchema: {},
  • Registration of the 'get_sessions' tool via server.registerTool(), which wires the tool name, schema, and handler together.
    server.registerTool(
      "get_sessions",
      {
        description: "List all WhatsApp sessions currently managed by OpenWA",
        inputSchema: {},
      },
      async () => {
        const data = await openwaClient({ method: "GET", path: "/sessions" });
        return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
      }
    );
  • src/index.ts:15-22 (registration)
    Where registerSessionTools (which includes get_sessions registration) is called in the main entry point.
    registerSessionTools(server);
    registerMessageTools(server);
    registerBulkTools(server);
    registerGroupTools(server);
    registerContactTools(server);
    registerWebhookTools(server);
    registerLabelTools(server);
    registerMediaTools(server);
  • The openwaClient helper function that the get_sessions handler uses to make the actual HTTP GET request 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;
      }
    }
Behavior3/5

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

Description indicates a read-only listing operation, but with no annotations, it does not disclose authorization needs, rate limits, or whether sessions are active/inactive.

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 front-loaded sentence with no unnecessary words or repetition.

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?

Description is adequate for a no-parameter tool but without an output schema, it doesn't specify what fields are returned for each session, which could be ambiguous given sibling tools like get_session_status.

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

Parameters4/5

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

Input schema has no parameters (baseline 4), and description adds context by specifying that it lists all sessions, though no parameter details are needed.

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?

Description clearly states 'List all WhatsApp sessions currently managed by OpenWA', using specific verb 'List' and resource 'sessions', distinguishing it from sibling tools like create_session, delete_session, etc.

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 get_session_status or get_session_qr; usage is only implied by the name and description.

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