Skip to main content
Glama
by wsapi-chat

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

NameRequiredDescriptionDefault
groupIdYesGroup ID (with @g.us)
nameYesNew 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

  • 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' }; }, };
  • 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}`); }); });
  • Bundles the updateGroupName tool (among others) into groupTools object, which is imported and registered by the server.
    export const groupTools = { getGroups, createGroup, getGroup, updateGroupName };
  • 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]);

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