Skip to main content
Glama

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
NameRequiredDescriptionDefault
chatIdYesChat ID (format: number@c.us)

Implementation Reference

  • 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)}`,
          },
        ],
      };
    }
  • 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);
  • 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",
      });
    }

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/seejux/waha-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server