Skip to main content
Glama

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
NameRequiredDescriptionDefault
chatIdYesChat ID (format: number@c.us)
messageIdYesMessage 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"],
      },
    },
  • Main MCP tool handler that validates parameters, calls WAHAClient.deleteMessage, and returns formatted success response
    private 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}.`,
          },
        ],
      };
    }
  • Input schema definition for the tool, specifying required chatId and messageId parameters
    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"],
    },
  • WAHAClient helper method that performs the actual HTTP DELETE request to the WAHA API endpoint for deleting a message
    async 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",
      });
    }

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