waha_delete_message
Remove a specific message from a WhatsApp chat using the WAHA MCP Server. This destructive operation permanently deletes the selected message.
Instructions
Delete a specific message from a chat. This is a destructive operation and cannot be undone.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chatId | Yes | Chat ID (format: number@c.us) | |
| messageId | Yes | Message ID to delete (format: {fromMe}_{chat}_{message_id}[_{participant}]) |
Implementation Reference
- src/index.ts:165-183 (registration)Tool registration including schema and description in ListToolsRequestSchema handler}, { name: "waha_delete_message", description: "Delete a specific message from a chat. This is a destructive operation and cannot be undone.", inputSchema: { type: "object", properties: { chatId: { type: "string", description: "Chat ID (format: number@c.us)", }, messageId: { type: "string", description: "Message ID to delete (format: {fromMe}_{chat}_{message_id}[_{participant}])", }, }, required: ["chatId", "messageId"], }, },
- src/index.ts:1340-1362 (handler)Main MCP tool handler that validates parameters, calls WAHAClient.deleteMessage, and returns formatted success responseprivate async handleDeleteMessage(args: any) { const chatId = args.chatId; const messageId = args.messageId; if (!chatId) { throw new Error("chatId is required"); } if (!messageId) { throw new Error("messageId is required"); } await this.wahaClient.deleteMessage(chatId, messageId); return { content: [ { type: "text", text: `Successfully deleted message ${messageId} from chat ${chatId}.`, }, ], }; }
- src/index.ts:169-182 (schema)Input schema definition for the tool, specifying required chatId and messageId parametersinputSchema: { type: "object", properties: { chatId: { type: "string", description: "Chat ID (format: number@c.us)", }, messageId: { type: "string", description: "Message ID to delete (format: {fromMe}_{chat}_{message_id}[_{participant}])", }, }, required: ["chatId", "messageId"], },
- src/client/waha-client.ts:298-314 (helper)WAHAClient helper method that performs the actual HTTP DELETE request to the WAHA API endpoint for deleting a messageasync deleteMessage(chatId: string, messageId: string): Promise<void> { if (!chatId) { throw new WAHAError("chatId is required"); } if (!messageId) { throw new WAHAError("messageId is required"); } const endpoint = `/api/${this.session}/chats/${encodeURIComponent( chatId )}/messages/${encodeURIComponent(messageId)}`; await this.request<void>(endpoint, { method: "DELETE", }); }