Skip to main content
Glama
wsapi-chat

WSAPI WhatsApp MCP Server

by wsapi-chat

whatsapp_star_message

Mark important WhatsApp messages with stars to organize conversations and highlight key information within chats.

Instructions

Star or unstar a message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageIdYesID of the message to star
chatIdYesChat ID where the message is located
senderIdYesID of the message sender

Implementation Reference

  • The complete ToolHandler implementation for the 'whatsapp_star_message' tool, including name, description, input schema (for MCP), and the async handler function that validates input and calls the WSAPI to star/unstar the message.
    export const starMessage: ToolHandler = {
      name: 'whatsapp_star_message',
      description: 'Star or unstar a message.',
      inputSchema: {
        type: 'object',
        properties: {
          messageId: {
            type: 'string',
            description: 'ID of the message to star',
          },
          chatId: {
            type: 'string',
            description: 'Chat ID where the message is located',
          },
          senderId: {
            type: 'string',
            description: 'ID of the message sender',
          },
        },
        required: ['messageId', 'chatId', 'senderId'],
      },
      handler: async (args: any) => {
        const input = validateInput(starMessageSchema, args);
    
        logger.info('Starring message', {
          messageId: input.messageId,
          chatId: input.chatId,
        });
    
        await wsapiClient.put(`/messages/${input.messageId}/star`, {
          chatId: input.chatId,
          senderId: input.senderId,
        });
    
        logger.info('Message starred successfully', { messageId: input.messageId });
    
        return {
          success: true,
          message: 'Message starred successfully',
        };
      },
    };
  • Zod schema used for input validation in the starMessage handler, defining required fields: messageId, chatId, senderId.
    export const starMessageSchema = z.object({
      messageId: messageIdSchema,
      chatId: chatIdSchema,
      senderId: phoneNumberSchema,
    });
  • src/server.ts:53-79 (registration)
    Registration of all tools including messagingTools (which contains whatsapp_star_message) into the server's tools Map during server initialization.
    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`);
    }
  • Export of messagingTools object that bundles the starMessage tool handler for registration in the server.
    export const messagingTools = {
      sendTextMessage,
      sendImageMessage,
      sendVideoMessage,
      sendLinkMessage,
      sendReactionMessage,
      editMessage,
      deleteMessage,
      markMessageAsRead,
      starMessage,
      ...advancedMessagingTools,
    };

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