Skip to main content
Glama
wsapi-chat

WSAPI WhatsApp MCP Server

by wsapi-chat

whatsapp_set_chat_presence

Update your presence status in WhatsApp chats to show typing, recording, or paused states, enabling real-time communication feedback.

Instructions

Set presence status in a chat (typing, recording, paused).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chatIdYesChat ID
stateYesPresence state

Implementation Reference

  • Core implementation of the 'whatsapp_set_chat_presence' tool handler. Defines the tool metadata, inline input schema, performs validation using the dedicated Zod schema, makes a PUT request to the WSAPI to set the chat presence, and returns success response.
    export const setChatPresence: ToolHandler = {
      name: 'whatsapp_set_chat_presence',
      description: 'Set presence status in a chat (typing, recording, paused).',
      inputSchema: {
        type: 'object',
        properties: {
          chatId: { type: 'string', description: 'Chat ID' },
          state: { type: 'string', enum: ['typing', 'recording', 'paused'], description: 'Presence state' },
        },
        required: ['chatId', 'state'],
      },
      handler: async (args: any) => {
        const input = validateInput(setChatPresenceSchema, args);
        await wsapiClient.put(`/chats/${input.chatId}/presence`, { state: input.state });
        return { success: true, message: 'Chat presence updated successfully' };
      },
    };
  • Zod schema for input validation specific to the whatsapp_set_chat_presence tool, defining chatId and state (typing/recording/paused). Used in the handler's validateInput call.
    export const setChatPresenceSchema = z.object({
      chatId: chatIdSchema,
      state: z.enum(['typing', 'recording', 'paused']),
    });
  • src/server.ts:57-78 (registration)
    Registration logic in the MCP server setup. Includes chatTools (containing setChatPresence) in toolCategories array and iterates to register each tool by name in the server's tools Map.
    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`);
  • src/server.ts:18-18 (registration)
    Import of chatTools object (which exports setChatPresence handler) necessary for registration.
    import { chatTools } from './tools/chats.js';

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