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
| Name | Required | Description | Default |
|---|---|---|---|
| chatId | Yes | Chat ID | |
| state | Yes | Presence 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
- src/tools/chats.ts:34-50 (handler)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' }; }, };
- src/validation/schemas.ts:229-232 (schema)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']), });
- src/tools/chats.ts:88-88 (registration)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`); }