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
| Name | Required | Description | Default |
|---|---|---|---|
| chatId | Yes | Chat ID to mark as read (format: number@c.us) | |
| messages | No | Number of recent messages to mark as read (default: 30) | |
| days | No | Mark messages from last N days as read (default: 7) |
Implementation Reference
- src/index.ts:1312-1335 (handler)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"], },
- src/client/waha-client.ts:225-245 (helper)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", }); }
- src/types/waha.ts:112-116 (schema)TypeScript interface defining input parameters for markChatAsRead: chatId (required), optional messages count and days.export interface MarkChatAsReadParams { chatId: ChatId; messages?: number; days?: number; }