whatsapp_create_group
Create a new WhatsApp group by specifying a group name and adding participants using their phone numbers. This tool enables organized communication and collaboration within dedicated group spaces on WhatsApp.
Instructions
Create a new WhatsApp group.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Group name (max 255 characters) | |
| participants | Yes | List of participant phone numbers |
Implementation Reference
- src/tools/groups.ts:19-36 (handler)The complete ToolHandler object for 'whatsapp_create_group', including the core handler function that performs input validation and calls the WSAPI to create a WhatsApp group.export const createGroup: ToolHandler = { name: 'whatsapp_create_group', description: 'Create a new WhatsApp group.', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Group name (max 255 characters)' }, participants: { type: 'array', items: { type: 'string' }, description: 'List of participant phone numbers' }, }, required: ['name', 'participants'], }, handler: async (args: any) => { const input = validateInput(createGroupSchema, args); logger.info('Creating group', { name: input.name, participantCount: input.participants.length }); const result = await wsapiClient.post('/groups', input); return { success: true, groupId: result.id, message: 'Group created successfully' }; }, };
- src/validation/schemas.ts:195-198 (schema)Zod schema used for validating the input parameters (name and participants) in the whatsapp_create_group handler.export const createGroupSchema = z.object({ name: z.string().min(1).max(255), participants: z.array(phoneNumberSchema).min(1), });
- src/server.ts:53-79 (registration)The setupToolHandlers method that registers all tools, including whatsapp_create_group from groupTools, into the MCP server's 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:17-17 (registration)Import statement that brings in the groupTools object containing the whatsapp_create_group tool.import { groupTools } from './tools/groups.js';