Skip to main content
Glama
wsapi-chat
by wsapi-chat

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
NameRequiredDescriptionDefault
messageIdYesID of the message to mark as read
chatIdYesChat ID where the message is located
senderIdYesID of the message sender
receiptTypeYesType of receipt to send

Implementation Reference

  • 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', }; }, };
  • 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']), });
  • 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`); }

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/wsapi-chat/wsapi-mcp'

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