whatsapp_get_chats
Retrieve a complete list of all WhatsApp conversations to access chat history and manage messaging interactions through the WSAPI WhatsApp MCP Server.
Instructions
Get list of all WhatsApp chats.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/chats.ts:8-17 (handler)The handler function for the 'whatsapp_get_chats' tool, which fetches and returns the list of all WhatsApp chats using the wsapiClient.export const getChats: ToolHandler = { name: 'whatsapp_get_chats', description: 'Get list of all WhatsApp chats.', inputSchema: { type: 'object', properties: {} }, handler: async () => { logger.info('Getting chats list'); const result = await wsapiClient.get('/chats'); return { success: true, chats: result, count: result.length }; }, };
- src/tools/chats.ts:8-17 (schema)Input schema definition for the 'whatsapp_get_chats' tool (empty object, no parameters required).export const getChats: ToolHandler = { name: 'whatsapp_get_chats', description: 'Get list of all WhatsApp chats.', inputSchema: { type: 'object', properties: {} }, handler: async () => { logger.info('Getting chats list'); const result = await wsapiClient.get('/chats'); return { success: true, chats: result, count: result.length }; }, };
- src/server.ts:57-76 (registration)Tool registration logic in setupToolHandlers method, where chatTools (containing whatsapp_get_chats) is added to the tools Map.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}`); }); });
- src/tools/chats.ts:88-88 (registration)Grouping export of chat-related tools including getChats (whatsapp_get_chats) for registration in server.export const chatTools = { getChats, getChat, setChatPresence, archiveChat, pinChat };