waha_block_contact
Block unwanted WhatsApp contacts to prevent further communication. Specify the contact ID to restrict messages and calls from that user.
Instructions
Block a contact.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| contactId | Yes | Contact ID to block (format: number@c.us) |
Implementation Reference
- src/index.ts:2542-2559 (handler)MCP tool handler for 'waha_block_contact'. Validates input, calls WAHAClient.blockContact, returns success response.private async handleBlockContact(args: any) { const contactId = args.contactId; if (!contactId) { throw new Error("contactId is required"); } await this.wahaClient.blockContact(contactId); return { content: [ { type: "text", text: `Successfully blocked contact ${contactId}.`, }, ], }; }
- src/index.ts:958-971 (registration)Tool registration entry in listTools response, including name, description, and input schema.{ name: "waha_block_contact", description: "Block a contact.", inputSchema: { type: "object", properties: { contactId: { type: "string", description: "Contact ID to block (format: number@c.us)", }, }, required: ["contactId"], }, },
- src/index.ts:961-970 (schema)Input schema definition for the waha_block_contact tool.inputSchema: { type: "object", properties: { contactId: { type: "string", description: "Contact ID to block (format: number@c.us)", }, }, required: ["contactId"], },
- src/client/waha-client.ts:1353-1367 (helper)WAHAClient helper method that sends POST request to WAHA API endpoint /api/contacts/block to block the contact.async blockContact(contactId: string): Promise<void> { if (!contactId) { throw new WAHAError("contactId is required"); } const body = { contactId, session: this.session, }; await this.request<void>("/api/contacts/block", { method: "POST", body: JSON.stringify(body), }); }