whatsapp_get_qr_code_image
Generate a QR code image to authenticate and log into WhatsApp through the WSAPI service for session management.
Instructions
Get QR code image for WhatsApp login.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/session.ts:30-39 (handler)The primary handler implementation for the 'whatsapp_get_qr_code_image' tool. It fetches the QR code image by calling the WSAPI endpoint '/session/login/qr/image' via wsapiClient and returns the result.export const getQRCodeImage: ToolHandler = { name: 'whatsapp_get_qr_code_image', description: 'Get QR code image for WhatsApp login.', inputSchema: { type: 'object', properties: {} }, handler: async () => { logger.info('Getting QR code image'); const result = await wsapiClient.get('/session/login/qr/image'); return { success: true, image: result, message: 'QR code image retrieved successfully' }; }, };
- src/tools/session.ts:68-68 (helper)Helper object that bundles all session-related tool handlers, including 'whatsapp_get_qr_code_image', for convenient import and registration.export const sessionTools = { getSessionStatus, getQRCode, getQRCodeImage, getPairCode, logout };
- src/server.ts:53-79 (registration)Registration logic in the MCP server that includes the sessionTools bundle (containing whatsapp_get_qr_code_image) in toolCategories and registers each tool handler into the server's tools Map.private setupToolHandlers(): void { logger.info('Setting up tool handlers'); // 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}`); }); }); logger.info(`Registered ${this.tools.size} tools`); }