Skip to main content
Glama
wsapi-chat
by wsapi-chat

whatsapp_get_contacts

Retrieve all WhatsApp contacts from the WSAPI WhatsApp MCP Server to manage and access contact information for messaging and communication purposes.

Instructions

Get list of all WhatsApp contacts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'whatsapp_get_contacts' tool. It fetches the list of all WhatsApp contacts using wsapiClient.get('/contacts') and returns them along with a count.
    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`, }; }, };
  • Input schema for whatsapp_get_contacts tool (no required parameters).
    inputSchema: { type: 'object', properties: {}, },
  • src/server.ts:53-79 (registration)
    Tool registration logic in setupToolHandlers(). The contactTools object (containing whatsapp_get_contacts) is included in toolCategories and its tools are registered in the Map used for tool execution.
    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:16-16 (registration)
    Import of contactTools which provides the whatsapp_get_contacts handler.
    import { contactTools } from './tools/contacts.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