Skip to main content
Glama

waha_mark_chat_read

Mark WhatsApp chat messages as read by specifying chat ID, number of recent messages, or time range in days.

Instructions

Mark messages in a chat as read. Can specify number of recent messages or time range in days.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chatIdYesChat ID to mark as read (format: number@c.us)
messagesNoNumber of recent messages to mark as read (default: 30)
daysNoMark messages from last N days as read (default: 7)

Implementation Reference

  • MCP tool handler function that extracts parameters, validates chatId, calls WAHAClient.markChatAsRead, and returns formatted success response.
    private async handleMarkChatRead(args: any) {
      const chatId = args.chatId;
      const messages = args.messages || 30;
      const days = args.days || 7;
    
      if (!chatId) {
        throw new Error("chatId is required");
      }
    
      await this.wahaClient.markChatAsRead({
        chatId,
        messages,
        days,
      });
    
      return {
        content: [
          {
            type: "text",
            text: `Successfully marked messages as read in chat ${chatId}.\nMessages: ${messages}\nDays: ${days}`,
          },
        ],
      };
    }
  • src/index.ts:143-164 (registration)
    Tool registration in ListToolsRequestHandler including name, description, and input schema definition.
    name: "waha_mark_chat_read",
    description: "Mark messages in a chat as read. Can specify number of recent messages or time range in days.",
    inputSchema: {
      type: "object",
      properties: {
        chatId: {
          type: "string",
          description: "Chat ID to mark as read (format: number@c.us)",
        },
        messages: {
          type: "number",
          description: "Number of recent messages to mark as read (default: 30)",
          default: 30,
        },
        days: {
          type: "number",
          description: "Mark messages from last N days as read (default: 7)",
          default: 7,
        },
      },
      required: ["chatId"],
    },
  • WAHAClient helper method that makes POST request to WAHA API endpoint to mark specified number of recent messages or messages from last N days as read.
    async markChatAsRead(params: MarkChatAsReadParams): Promise<void> {
      const { chatId, messages = 30, days = 7 } = params;
    
      if (!chatId) {
        throw new WAHAError("chatId is required");
      }
    
      const queryParams = {
        messages,
        days,
      };
    
      const queryString = this.buildQueryString(queryParams);
      const endpoint = `/api/${this.session}/chats/${encodeURIComponent(
        chatId
      )}/messages/read${queryString}`;
    
      await this.request<void>(endpoint, {
        method: "POST",
      });
    }
  • TypeScript interface defining input parameters for markChatAsRead: chatId (required), optional messages count and days.
    export interface MarkChatAsReadParams {
      chatId: ChatId;
      messages?: number;
      days?: number;
    }

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