whatsapp_get_contacts
Retrieve a complete list of all WhatsApp contacts from the connected account to enable contact lookup and management operations.
Instructions
Get list of all WhatsApp contacts.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"type": "object"
}
Implementation Reference
- src/tools/contacts.ts:15-36 (handler)The complete ToolHandler implementation for 'whatsapp_get_contacts', which fetches the list of all WhatsApp contacts using wsapiClient.get('/contacts') and returns them with metadata.export const getContacts: ToolHandler = { name: 'whatsapp_get_contacts', description: 'Get list of all WhatsApp contacts.', inputSchema: { type: 'object', properties: {}, }, handler: async () => { logger.info('Getting contacts list'); const result = await wsapiClient.get('/contacts'); logger.info('Retrieved contacts successfully', { count: result.length }); return { success: true, contacts: result, count: result.length, message: `Retrieved ${result.length} contacts`, }; }, };
- src/server.ts:57-76 (registration)Registers all tools dynamically by iterating over tool category objects, including 'contactTools' which exports the 'whatsapp_get_contacts' handler.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/contacts.ts:18-21 (schema)Input schema for 'whatsapp_get_contacts' tool, which takes no parameters (empty object).inputSchema: { type: 'object', properties: {}, },