whatsapp_get_groups
Retrieve a complete list of all WhatsApp groups from your account to manage group communications and access group information.
Instructions
Get list of all WhatsApp groups.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"type": "object"
}
Implementation Reference
- src/tools/groups.ts:8-17 (handler)The primary implementation of the 'whatsapp_get_groups' tool as a ToolHandler, including description, empty input schema, and async handler that fetches groups from wsapiClient.get('/groups') and returns them with count.export const getGroups: ToolHandler = { name: 'whatsapp_get_groups', description: 'Get list of all WhatsApp groups.', inputSchema: { type: 'object', properties: {} }, handler: async () => { logger.info('Getting groups list'); const result = await wsapiClient.get('/groups'); return { success: true, groups: result, count: result.length }; }, };
- src/server.ts:53-79 (registration)The setupToolHandlers method registers all tools from imported categories (including groupTools containing whatsapp_get_groups) into the server's tools Map by name.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:17-17 (registration)Import of groupTools from groups.ts, which bundles the whatsapp_get_groups handler for server registration.import { groupTools } from './tools/groups.js';
- src/tools/groups.ts:71-71 (registration)Bundles the getGroups (whatsapp_get_groups) handler with other group tools for collective import and registration in the server.export const groupTools = { getGroups, createGroup, getGroup, updateGroupName };