Skip to main content
Glama

waha_clear_chat_messages

Clear all messages from a WhatsApp chat. This destructive operation permanently removes chat history and cannot be undone.

Instructions

Clear all messages from a chat. WARNING: This is a destructive operation that cannot be undone.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chatIdYesChat ID (format: number@c.us)

Implementation Reference

  • The primary handler function for the 'waha_clear_chat_messages' tool. It validates input, calls the WAHAClient.clearChatMessages method, and returns a confirmation message warning about the destructive nature of the operation.
    private async handleClearChatMessages(args: any) { const chatId = args.chatId; if (!chatId) { throw new Error("chatId is required"); } await this.wahaClient.clearChatMessages(chatId); return { content: [ { type: "text", text: `WARNING: All messages have been cleared from chat ${chatId}.\nThis operation cannot be undone.`, }, ], }; }
  • Input schema definition for the tool, specifying the required 'chatId' parameter and description.
    name: "waha_clear_chat_messages", description: "Clear all messages from a chat. WARNING: This is a destructive operation that cannot be undone.", inputSchema: { type: "object", properties: { chatId: { type: "string", description: "Chat ID (format: number@c.us)", }, }, required: ["chatId"], }, },
  • src/index.ts:1067-1073 (registration)
    Registration and dispatch logic in the CallToolRequestSchema handler's switch statement that routes calls to the specific handler function.
    case "waha_clear_chat_messages": return await this.handleClearChatMessages(args); case "waha_delete_chat": return await this.handleDeleteChat(args); case "waha_archive_chat": return await this.handleArchiveChat(args); case "waha_unarchive_chat":
  • Underlying WAHAClient helper method that performs the actual HTTP DELETE request to the WAHA API endpoint to clear messages from the specified chat.
    async clearChatMessages(chatId: string): Promise<void> { if (!chatId) { throw new WAHAError("chatId is required"); } const endpoint = `/api/${this.session}/chats/${encodeURIComponent( chatId )}/messages`; await this.request<void>(endpoint, { method: "DELETE", }); }

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/seejux/waha-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server