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

whatsapp_update_contact

Modify contact details in WhatsApp, including full name and first name, using the contact ID to identify and update existing entries.

Instructions

Update an existing WhatsApp contact.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contactIdYesContact ID (phone number with @s.whatsapp.net)
fullNameYesFull name of the contact (max 255 characters)
firstNameYesFirst name of the contact (max 255 characters)

Implementation Reference

  • The ToolHandler implementation for 'whatsapp_update_contact'. Defines the tool metadata, input schema, and the async handler function that validates input, logs the update action, sends a PUT request to the WSAPI endpoint `/contacts/{contactId}` with fullName and firstName, logs success, and returns a success response.
    export const updateContact: ToolHandler = { name: 'whatsapp_update_contact', description: 'Update an existing WhatsApp contact.', inputSchema: { type: 'object', properties: { contactId: { type: 'string', description: 'Contact ID (phone number with @s.whatsapp.net)', }, fullName: { type: 'string', description: 'Full name of the contact (max 255 characters)', }, firstName: { type: 'string', description: 'First name of the contact (max 255 characters)', }, }, required: ['contactId', 'fullName', 'firstName'], }, handler: async (args: any) => { const input = validateInput(updateContactSchema, args); logger.info('Updating contact', { contactId: input.contactId, fullName: input.fullName, }); await wsapiClient.put(`/contacts/${input.contactId}`, { fullName: input.fullName, firstName: input.firstName, }); logger.info('Contact updated successfully', { contactId: input.contactId }); return { success: true, message: 'Contact updated successfully', }; }, };
  • Zod validation schema used in the whatsapp_update_contact handler for input validation. Defines required fields: contactId (phone number), fullName and firstName (strings max 255 chars).
    export const updateContactSchema = z.object({ contactId: phoneNumberSchema, fullName: z.string().min(1).max(255), firstName: z.string().min(1).max(255), });
  • src/server.ts:57-76 (registration)
    Registration logic in the MCP server setupToolHandlers method. Imports contactTools (which includes whatsapp_update_contact) and registers all tools from various categories into the server's tools Map by name.
    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}`); }); });

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