whatsapp_mark_message_read
Mark WhatsApp messages as read to update message status and manage chat notifications. Use this tool to send read receipts for messages in specific chats.
Instructions
Mark a message as read.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| messageId | Yes | ID of the message to mark as read | |
| chatId | Yes | Chat ID where the message is located | |
| senderId | Yes | ID of the message sender | |
| receiptType | Yes | Type of receipt to send |
Implementation Reference
- src/tools/messaging.ts:446-494 (handler)Core implementation of the whatsapp_mark_message_read tool, including inline input schema, validation using Zod schema, API call to mark message read via wsapiClient, logging, and success response.export const markMessageAsRead: ToolHandler = { name: 'whatsapp_mark_message_read', description: 'Mark a message as read.', inputSchema: { type: 'object', properties: { messageId: { type: 'string', description: 'ID of the message to mark as read', }, chatId: { type: 'string', description: 'Chat ID where the message is located', }, senderId: { type: 'string', description: 'ID of the message sender', }, receiptType: { type: 'string', enum: ['delivered', 'sender', 'read', 'played'], description: 'Type of receipt to send', }, }, required: ['messageId', 'chatId', 'senderId', 'receiptType'], }, handler: async (args: any) => { const input = validateInput(markMessageAsReadSchema, args); logger.info('Marking message as read', { messageId: input.messageId, chatId: input.chatId, receiptType: input.receiptType, }); await wsapiClient.put(`/messages/${input.messageId}/read`, { chatId: input.chatId, senderId: input.senderId, receiptType: input.receiptType, }); logger.info('Message marked as read successfully', { messageId: input.messageId }); return { success: true, message: 'Message marked as read successfully', }; }, };
- src/validation/schemas.ts:159-164 (schema)Zod schema for validating input to the whatsapp_mark_message_read tool, used in the handler's validateInput call. Defines structure for messageId, chatId, senderId, and receiptType.export const markMessageAsReadSchema = z.object({ messageId: messageIdSchema, chatId: chatIdSchema, senderId: phoneNumberSchema, receiptType: z.enum(['delivered', 'sender', 'read', 'played']), });
- src/tools/messaging.ts:544-555 (registration)Groups the markMessageAsRead handler with other messaging tools for export and subsequent registration in the MCP server.export const messagingTools = { sendTextMessage, sendImageMessage, sendVideoMessage, sendLinkMessage, sendReactionMessage, editMessage, deleteMessage, markMessageAsRead, starMessage, ...advancedMessagingTools, };
- src/server.ts:53-79 (registration)Registers all tools, including those from messagingTools (containing whatsapp_mark_message_read), into the MCP server's tools Map by iterating over tool categories.private setupToolHandlers(): void { logger.info('Setting up tool handlers'); // Register all tool categories const toolCategories = [ messagingTools, contactTools, groupTools, chatTools, sessionTools, instanceTools, accountTools, ]; toolCategories.forEach(category => { Object.values(category).forEach(tool => { if (this.tools.has(tool.name)) { logger.warn(`Tool ${tool.name} already registered, skipping`); return; } this.tools.set(tool.name, tool); logger.debug(`Registered tool: ${tool.name}`); }); }); logger.info(`Registered ${this.tools.size} tools`); }