Skip to main content
Glama
by wsapi-chat

whatsapp_set_chat_presence

Set your presence status in a WhatsApp chat to indicate typing, recording voice, or pausing activity, helping other participants understand your current activity state.

Instructions

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

Input Schema

NameRequiredDescriptionDefault
chatIdYesChat ID
stateYesPresence state

Input Schema (JSON Schema)

{ "properties": { "chatId": { "description": "Chat ID", "type": "string" }, "state": { "description": "Presence state", "enum": [ "typing", "recording", "paused" ], "type": "string" } }, "required": [ "chatId", "state" ], "type": "object" }

Implementation Reference

  • The main ToolHandler for 'whatsapp_set_chat_presence' tool. Defines the tool metadata and the handler function that validates the input using setChatPresenceSchema and calls the WSAPI client to set the chat presence.
    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 definition for input validation of the whatsapp_set_chat_presence tool, defining chatId and state fields.
    export const setChatPresenceSchema = z.object({ chatId: chatIdSchema, state: z.enum(['typing', 'recording', 'paused']), });
  • chatTools export grouping the setChatPresence handler with other chat-related tools for registration in the MCP server.
    export const chatTools = { getChats, getChat, setChatPresence, archiveChat, pinChat };
  • src/server.ts:53-79 (registration)
    The MCP server method that imports and registers all tool groups, including chatTools containing whatsapp_set_chat_presence, into the tools Map.
    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