Skip to main content
Glama
ExoCubeYT

OpenWA MCP Server

by ExoCubeYT

get_session_qr

Retrieve QR code data to authenticate a WhatsApp session by scanning with the mobile app.

Instructions

Get the QR code data for authenticating a WhatsApp session. Use this when a session needs to be scanned with WhatsApp mobile.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesID of the session to get QR for

Implementation Reference

  • Tool 'get_session_qr' is registered via server.registerTool with description, input schema (sessionId), and handler.
    server.registerTool(
      "get_session_qr",
      {
        description: "Get the QR code data for authenticating a WhatsApp session. Use this when a session needs to be scanned with WhatsApp mobile.",
        inputSchema: {
          sessionId: z.string().describe("ID of the session to get QR for"),
        },
      },
      async ({ sessionId }) => {
        const data = await openwaClient({ method: "GET", path: `/sessions/${sessionId}/qr` });
        return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
      }
    );
  • Input schema for get_session_qr: sessionId (string) via Zod.
    inputSchema: {
      sessionId: z.string().describe("ID of the session to get QR for"),
    },
  • Handler function that makes a GET request to /sessions/{sessionId}/qr via openwaClient and returns the QR code data as JSON text.
    async ({ sessionId }) => {
      const data = await openwaClient({ method: "GET", path: `/sessions/${sessionId}/qr` });
      return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
    }
  • The openwaClient helper function that performs HTTP requests to the OpenWA API. Used by the handler to fetch QR data.
    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:4-4 (registration)
    Registration is triggered by calling registerSessionTools(server) in the main entry point.
    import { registerSessionTools } from "./tools/sessions.js";
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It mentions 'authenticating' but doesn't specify side effects or prerequisites (e.g., session must exist). However, it's a simple get operation, and the purpose is transparent enough.

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?

Two concise sentences that front-load the action and usage context. No wasted words.

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?

For a simple tool with one parameter and no output schema, the description provides enough context: what it does and when to use it. It could mention the output format but is sufficient.

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% coverage with a description for 'sessionId'. The description adds no extra meaning beyond the schema, meeting the baseline of 3.

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 'Get' and the resource 'QR code data for authenticating a WhatsApp session'. It distinguishes itself from sibling tools like 'create_session' or 'start_session' by focusing on QR retrieval.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states when to use this tool: 'when a session needs to be scanned with WhatsApp mobile'. It doesn't explicitly mention when not to use or alternatives, but the context is clear.

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