whatsapp_get_chats
Retrieve all WhatsApp chat conversations from the WSAPI WhatsApp MCP Server to access message history and contact lists.
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. It fetches the list of chats from the WSAPI client and returns them with a count.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:53-79 (registration)The setupToolHandlers method registers all tools, including those from chatTools which contains the whatsapp_get_chats handler, by adding them to the 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`); }
- src/server.ts:18-18 (registration)Import of chatTools which provides the whatsapp_get_chats tool.import { chatTools } from './tools/chats.js';
- src/tools/chats.ts:11-11 (schema)Inline input schema for whatsapp_get_chats, which takes no parameters.inputSchema: { type: 'object', properties: {} },