whatsapp_unblock_contact
Unblock a WhatsApp contact by providing their JID, restoring normal messaging and contact management.
Instructions
Unblock a contact.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Contact JID to unblock |
Implementation Reference
- src/tools/contacts.ts:93-107 (handler)The main handler for the 'whatsapp_unblock_contact' tool. Makes a PUT request to /contacts/{id}/unblock to unblock a contact.
export const unblockContact: ToolHandler = { name: 'whatsapp_unblock_contact', description: 'Unblock a contact.', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Contact JID to unblock' } }, required: ['id'], }, handler: async (args: any) => { const input = validateInput(blockContactSchema, args); logger.info('Unblocking contact', { id: input.id }); await wsapiClient.put(`/contacts/${input.id}/unblock`, {}); return { success: true, message: 'Contact unblocked successfully' }; }, }; - src/validation/schemas.ts:170-172 (schema)Validation schema used by the unblock contact handler. Requires a non-empty 'id' string.
export const blockContactSchema = z.object({ id: z.string().min(1), }); - src/tools/contacts.ts:109-116 (registration)The unblockContact handler is exported as part of contactTools object, which gets imported into server.ts and registered as the 'contacts' category.
export const contactTools = { getContacts, getContact, createContact, syncContacts, getBlocklist, blockContact, unblockContact, - src/server.ts:61-63 (registration)contactTools (containing unblockContact) is registered in the 'contacts' category inside setupToolHandlers().
const allCategories: Record<string, Record<string, ToolHandler>> = { messaging: messagingTools, contacts: contactTools, - src/server.ts:122-132 (registration)Tools are iterated and registered into the internal Map. When CallToolRequestSchema fires, the handler is looked up by name and executed.
for (const tool of toolsToRegister) { if (this.tools.has(tool.name)) { logger.warn(`Tool ${tool.name} already registered, skipping`); continue; } this.tools.set(tool.name, tool); logger.debug(`Registered tool: ${tool.name}`); } logger.info(`Registered ${this.tools.size} tools`); }