Skip to main content
Glama
ExoCubeYT

OpenWA MCP Server

by ExoCubeYT

get_session_status

Verify the connection status of a WhatsApp session to ensure it is active and ready for messaging.

Instructions

Check the current connection status of a WhatsApp session (connected, disconnected, etc.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesID of the session to check

Implementation Reference

  • Handler function for get_session_status tool. Calls the OpenWA API GET /sessions/{sessionId}/status to retrieve the current connection status of a WhatsApp session and returns the result as formatted JSON text content.
    async ({ sessionId }) => {
      const data = await openwaClient({ method: "GET", path: `/sessions/${sessionId}/status` });
      return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
    }
  • Schema definition for get_session_status. Defines the tool description and input schema requiring a sessionId string parameter validated with Zod.
    {
      description: "Check the current connection status of a WhatsApp session (connected, disconnected, etc.)",
      inputSchema: {
        sessionId: z.string().describe("ID of the session to check"),
      },
  • Registration of the get_session_status tool on the MCP server via server.registerTool() inside the registerSessionTools function.
    server.registerTool(
      "get_session_status",
      {
        description: "Check the current connection status of a WhatsApp session (connected, disconnected, etc.)",
        inputSchema: {
          sessionId: z.string().describe("ID of the session to check"),
        },
      },
      async ({ sessionId }) => {
        const data = await openwaClient({ method: "GET", path: `/sessions/${sessionId}/status` });
        return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
      }
    );
  • The openwaClient helper function used by get_session_status handler to make authenticated HTTP requests to the OpenWA backend 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?

With no annotations, the description must convey behavioral traits. It only mentions 'check' (read operation) but omits details like whether the session must be started, error handling on invalid sessionId, rate limits, or response format. This is minimal disclosure for a status check tool.

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 a single, front-loaded sentence that efficiently communicates the tool's purpose. There is no extraneous information; every word is functional.

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?

Given the simplicity of the tool (one parameter, no nested objects), the description is mostly adequate but lacks detail about the return value (e.g., status strings like 'connected', 'disconnected'). Without an output schema, mentioning the response format would improve completeness.

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% (one parameter with clear description), so baseline is 3. The tool description does not add any additional meaning beyond what the schema provides, but it also does not detract. Rating is adequate.

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 verb 'Check' and the resource 'connection status of a WhatsApp session', with examples of statuses. Among sibling tools like get_session_qr, get_sessions, and start_session, this tool's unique purpose is immediately evident.

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 versus alternatives such as get_sessions (which may return status for all sessions) or start_session. The description simply states what the tool does without usage context.

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