Skip to main content
Glama
by wsapi-chat

whatsapp_get_qr_code

Generate a QR code to authenticate and log into a WhatsApp account through the WSAPI service, enabling AI assistants to establish WhatsApp sessions for messaging and management tasks.

Instructions

Get QR code for WhatsApp login.

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "properties": {}, "type": "object" }

Implementation Reference

  • The main handler implementation for the 'whatsapp_get_qr_code' tool. It fetches the QR code data from the WSAPI endpoint '/session/login/qr/code' and returns it in a success response.
    export const getQRCode: ToolHandler = { name: 'whatsapp_get_qr_code', description: 'Get QR code for WhatsApp login.', inputSchema: { type: 'object', properties: {} }, handler: async () => { logger.info('Getting QR code'); const result = await wsapiClient.get('/session/login/qr/code'); return { success: true, qrCode: result, message: 'QR code retrieved successfully' }; }, };
  • Groups the session-related tools, including the whatsapp_get_qr_code handler (as getQRCode), for registration in the MCP server.
    export const sessionTools = { getSessionStatus, getQRCode, getQRCodeImage, getPairCode, logout };
  • src/server.ts:19-19 (registration)
    Imports the sessionTools object containing the whatsapp_get_qr_code tool handler.
    import { sessionTools } from './tools/session.js';
  • src/server.ts:62-62 (registration)
    Includes sessionTools in the toolCategories array used for registering all tools.
    sessionTools,
  • src/server.ts:56-76 (registration)
    The registration logic that iterates over tool categories (including sessionTools) and adds each tool to the server's tools Map using its name.
    // Register all tool categories const toolCategories = [ messagingTools, contactTools, groupTools, chatTools, sessionTools, instanceTools, accountTools, ]; toolCategories.forEach(category => { Object.values(category).forEach(tool => { if (this.tools.has(tool.name)) { logger.warn(`Tool ${tool.name} already registered, skipping`); return; } this.tools.set(tool.name, tool); logger.debug(`Registered tool: ${tool.name}`); }); });

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/wsapi-chat/wsapi-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server