Skip to main content
Glama
by wsapi-chat

whatsapp_logout

Log out of a WhatsApp session to end the current connection and ensure account security when switching devices or completing automated tasks.

Instructions

Logout from WhatsApp.

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

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

Implementation Reference

  • The ToolHandler object that implements the 'whatsapp_logout' tool. It defines the schema (empty input), description, and the async handler function that logs info, calls the WSAPI logout endpoint, and returns success message.
    export const logout: ToolHandler = { name: 'whatsapp_logout', description: 'Logout from WhatsApp.', inputSchema: { type: 'object', properties: {} }, handler: async () => { logger.info('Logging out'); await wsapiClient.post('/session/logout', {}); return { success: true, message: 'Logged out successfully' }; }, };
  • src/server.ts:56-79 (registration)
    The registration logic in setupToolHandlers() that includes sessionTools in toolCategories and dynamically registers all tools (including whatsapp_logout) into the server's tool Map by 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}`); }); }); logger.info(`Registered ${this.tools.size} tools`); }
  • Exports the sessionTools object bundling the logout handler (among others) for use in server registration.
    export const sessionTools = { getSessionStatus, getQRCode, getQRCodeImage, getPairCode, logout };
  • src/server.ts:19-19 (registration)
    Imports the sessionTools bundle containing the whatsapp_logout handler for registration.
    import { sessionTools } from './tools/session.js';

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