waha_get_presence
Check WhatsApp chat status (online/offline/typing) by providing a chat ID. Automatically subscribes to status updates if not already active.
Instructions
Get online/offline/typing status for a chat. Auto-subscribes if not already subscribed.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chatId | Yes | Chat ID (format: number@c.us) |
Implementation Reference
- src/index.ts:2588-2605 (handler)The primary handler function for the 'waha_get_presence' MCP tool. Extracts chatId from arguments, validates it, calls the WAHA client's getPresence method, and returns formatted presence data as text content.private async handleGetPresence(args: any) { const chatId = args.chatId; if (!chatId) { throw new Error("chatId is required"); } const presence = await this.wahaClient.getPresence(chatId); return { content: [ { type: "text", text: `Presence information for ${chatId}:\n${JSON.stringify(presence, null, 2)}`, }, ], }; }
- src/index.ts:987-998 (schema)The input schema and metadata definition for the 'waha_get_presence' tool, provided in the ListTools response. Specifies required chatId parameter.name: "waha_get_presence", description: "Get online/offline/typing status for a chat. Auto-subscribes if not already subscribed.", inputSchema: { type: "object", properties: { chatId: { type: "string", description: "Chat ID (format: number@c.us)", }, }, required: ["chatId"], },
- src/index.ts:1150-1150 (registration)Tool dispatch registration in the CallToolRequestSchema handler switch statement, routing calls to the handleGetPresence method.return await this.handleGetPresence(args);
- src/client/waha-client.ts:1395-1405 (helper)Underlying WAHAClient method that makes the HTTP GET request to retrieve presence information for a specific chat from the WAHA API.async getPresence(chatId: string): Promise<any> { if (!chatId) { throw new WAHAError("chatId is required"); } const endpoint = `/api/${this.session}/presence/${encodeURIComponent(chatId)}`; return this.request<any>(endpoint, { method: "GET", }); }