whatsapp_update_group_name
Change the name of a WhatsApp group by providing the group ID and the new desired name for the group.
Instructions
Update group name.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| groupId | Yes | Group ID (with @g.us) | |
| name | Yes | New group name |
Input Schema (JSON Schema)
{
"properties": {
"groupId": {
"description": "Group ID (with @g.us)",
"type": "string"
},
"name": {
"description": "New group name",
"type": "string"
}
},
"required": [
"groupId",
"name"
],
"type": "object"
}
Implementation Reference
- src/tools/groups.ts:53-69 (handler)Primary implementation of the whatsapp_update_group_name tool. Defines the tool metadata (name, description, inputSchema) and the handler function that validates input and performs the API call to update the group name.export const updateGroupName: ToolHandler = { name: 'whatsapp_update_group_name', description: 'Update group name.', inputSchema: { type: 'object', properties: { groupId: { type: 'string', description: 'Group ID (with @g.us)' }, name: { type: 'string', description: 'New group name' }, }, required: ['groupId', 'name'], }, handler: async (args: any) => { const input = validateInput(updateGroupNameSchema, args); await wsapiClient.put(`/groups/${input.groupId}/name`, { name: input.name }); return { success: true, message: 'Group name updated successfully' }; }, };
- src/validation/schemas.ts:204-207 (schema)Zod schema used for strict input validation within the tool handler (groupId must end with @g.us, name 1-255 chars). Referenced via validateInput.export const updateGroupNameSchema = z.object({ groupId: groupIdSchema, name: z.string().min(1).max(255), });
- src/server.ts:56-76 (registration)Tool registration logic in the MCP server. Imports groupTools (containing whatsapp_update_group_name) and registers all tools from categories into the server's tool map via this.tools.set(tool.name, tool).// 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}`); }); });
- src/tools/groups.ts:71-71 (registration)Bundles the updateGroupName tool (among others) into groupTools object, which is imported and registered by the server.export const groupTools = { getGroups, createGroup, getGroup, updateGroupName };
- src/validation/schemas.ts:5-6 (schema)Reusable Zod schema for groupId validation (must end with @g.us), used in updateGroupNameSchema.const groupIdSchema = z.string().regex(/@g\.us$/); const chatIdSchema = z.union([phoneNumberSchema, groupIdSchema]);