whatsapp_set_account_presence
Set your WhatsApp account presence status to available or unavailable. Control your online visibility and manage session activity through the WSAPI WhatsApp MCP Server.
Instructions
Set account presence status.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | Yes | Presence status |
Implementation Reference
- src/tools/account.ts:51-67 (handler)The primary handler implementation for the whatsapp_set_account_presence tool. Validates input with setAccountPresenceSchema, makes API call to set presence via wsapiClient, and returns success response.export const setAccountPresence: ToolHandler = { name: 'whatsapp_set_account_presence', description: 'Set account presence status.', inputSchema: { type: 'object', properties: { status: { type: 'string', enum: ['available', 'unavailable'], description: 'Presence status' }, }, required: ['status'], }, handler: async (args: any) => { const input = validateInput(setAccountPresenceSchema, args); logger.info('Setting account presence'); await wsapiClient.put('/account/presence', input); return { success: true, message: 'Account presence updated successfully' }; }, };
- src/validation/schemas.ts:268-270 (schema)Zod schema used for input validation in the whatsapp_set_account_presence handler. Defines 'status' as enum of 'available' or 'unavailable'.export const setAccountPresenceSchema = z.object({ status: z.enum(['available', 'unavailable']), });
- src/server.ts:53-79 (registration)Tool registration logic in the MCP server. accountTools (containing whatsapp_set_account_presence) is included in toolCategories and registered into the server's tools Map for handling tool calls.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`); }
- src/tools/account.ts:85-85 (registration)Export of accountTools object grouping account-related tools including whatsapp_set_account_presence for registration in the server.export const accountTools = { getAccountInfo, setAccountName, setAccountPicture, setAccountPresence, setAccountStatus };
- src/tools/account.ts:54-60 (schema)Inline inputSchema in the ToolHandler definition, matching the Zod schema, used by MCP SDK for tool input description.inputSchema: { type: 'object', properties: { status: { type: 'string', enum: ['available', 'unavailable'], description: 'Presence status' }, }, required: ['status'], },