Skip to main content
Glama

check_auth_status

Read-onlyIdempotent

Verify whether your WhatsApp client is authenticated and ready. This status check enables you to confirm connection before sending messages or managing contacts, ensuring operations proceed only when authenticated.

Instructions

Check if the WhatsApp client is authenticated and ready

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The `checkAuthStatus` function is the actual handler for the 'check_auth_status' tool. It calls `whatsappService.isAuthenticated()` and `whatsappService.isReady()` to determine the current authentication state, then returns a human-readable text result indicating whether the user is authenticated, ready, or needs to authenticate via QR code.
    async function checkAuthStatus(
      whatsappService: WhatsAppService,
    ): Promise<CallToolResult> {
      try {
        const isAuthenticated = whatsappService.isAuthenticated();
        const isReady = whatsappService.isReady();
    
        log.info(
          `Auth status checked: ${isAuthenticated ? "authenticated" : "not authenticated"}, ` +
            `ready: ${isReady ? "yes" : "no"}`,
        );
    
        return {
          content: [
            {
              type: "text",
              text: !isAuthenticated
                ? "You are not authenticated. Use get_qr_code to authenticate."
                : isReady
                  ? "Authenticated and ready."
                  : "Authenticated, but not ready yet. Please wait a few seconds and try again.",
            },
          ],
          isError: false,
        };
      } catch (error) {
        log.error("Error checking authentication status:", error);
        return {
          content: [
            {
              type: "text",
              text: `Error checking authentication status: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
          isError: true,
        };
      }
    }
  • The tool is registered with the MCP server via `server.tool('check_auth_status', ...)` inside the `registerAuthTools` function. It has no input schema and delegates to the `checkAuthStatus` handler.
    server.tool(
      "check_auth_status",
      "Check if the WhatsApp client is authenticated and ready",
      {},
      async (): Promise<CallToolResult> => {
        return await checkAuthStatus(whatsappService);
      },
    );
  • src/server.ts:241-261 (registration)
    The `registerAuthTools` function is called in `WhatsAppMcpServer.registerTools()` to register all auth-related tools including 'check_auth_status'.
    private registerTools(server: McpServer) {
      log.info("Registering MCP tools...");
      registerAuthTools(server, this.whatsapp);
      registerContactTools(server, this.whatsapp);
      registerChatTools(server, this.whatsapp);
      registerMessageTools(server, this.whatsapp);
      registerMediaTools(server, this.whatsapp);
    
      // Remove example dummy tool if no longer needed, or keep for testing
      // this.server.tool('ping', async () => ({
      //   content: [{ type: 'text', text: 'pong' }],
      // }));
      // Let's keep ping for now for basic testing
      server.tool("ping", async () => ({
        content: [{ type: "text", text: "pong" }],
      }));
    
      this.overrideListToolsHandler(server);
    
      log.info("MCP tools registered.");
    }
  • Execution metadata in `TOOL_EXECUTION_METADATA` defines 'check_auth_status' as read-only, idempotent, and not open-world. This metadata is attached to the tool listing response via the custom `ListToolsRequestSchema` handler.
    const TOOL_EXECUTION_METADATA: Record<string, ExecutionMetadata> = {
      ping: {
        readOnlyHint: true,
        idempotentHint: true,
        openWorldHint: false,
      },
      get_qr_code: {
        readOnlyHint: true,
        idempotentHint: true,
        openWorldHint: false,
      },
      check_auth_status: {
        readOnlyHint: true,
        idempotentHint: true,
        openWorldHint: false,
      },
      send_message: {
        readOnlyHint: false,
        idempotentHint: true,
        destructiveHint: false,
        openWorldHint: true,
      },
      send_media: {
        readOnlyHint: false,
        idempotentHint: true,
        destructiveHint: false,
        openWorldHint: true,
      },
      logout: {
        readOnlyHint: false,
        idempotentHint: true,
        destructiveHint: true,
        openWorldHint: false,
      },
      force_resync: {
        readOnlyHint: false,
        idempotentHint: false,
        destructiveHint: true,
        openWorldHint: false,
      },
      search_contacts: {
        readOnlyHint: true,
        idempotentHint: true,
        openWorldHint: true,
      },
      resolve_contact: {
        readOnlyHint: true,
        idempotentHint: true,
        openWorldHint: true,
      },
      get_contact_by_id: {
        readOnlyHint: true,
        idempotentHint: true,
        openWorldHint: false,
      },
      get_profile_pic: {
        readOnlyHint: true,
        idempotentHint: true,
        openWorldHint: true,
      },
      get_group_info: {
        readOnlyHint: true,
        idempotentHint: true,
        openWorldHint: true,
      },
      list_chats: {
        readOnlyHint: true,
        idempotentHint: true,
        openWorldHint: false,
      },
      list_system_chats: {
        readOnlyHint: true,
        idempotentHint: true,
        openWorldHint: false,
      },
      list_groups: {
        readOnlyHint: true,
        idempotentHint: true,
        openWorldHint: false,
      },
      get_chat_by_id: {
        readOnlyHint: true,
        idempotentHint: true,
        openWorldHint: false,
      },
      get_direct_chat_by_contact_number: {
        readOnlyHint: true,
        idempotentHint: true,
        openWorldHint: false,
      },
      get_chat_by_contact: {
        readOnlyHint: true,
        idempotentHint: true,
        openWorldHint: false,
      },
      analyze_group_overlaps: {
        readOnlyHint: true,
        idempotentHint: true,
        openWorldHint: true,
      },
      find_members_without_direct_chat: {
        readOnlyHint: true,
        idempotentHint: true,
        openWorldHint: true,
      },
      find_members_not_in_contacts: {
        readOnlyHint: true,
        idempotentHint: true,
        openWorldHint: true,
      },
      run_group_audit: {
        readOnlyHint: true,
        idempotentHint: true,
        openWorldHint: true,
      },
      list_messages: {
        readOnlyHint: true,
        idempotentHint: true,
        openWorldHint: false,
      },
      get_message_by_id: {
        readOnlyHint: true,
        idempotentHint: true,
        openWorldHint: false,
      },
      search_messages: {
        readOnlyHint: true,
        idempotentHint: true,
        openWorldHint: false,
      },
      get_message_context: {
        readOnlyHint: true,
        idempotentHint: true,
        openWorldHint: false,
      },
      get_last_interaction: {
        readOnlyHint: true,
        idempotentHint: true,
        openWorldHint: false,
      },
      download_media: {
        readOnlyHint: true,
        idempotentHint: true,
        openWorldHint: false,
      },
    };
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already provide readOnly and idempotent hints. Description adds no extra behavioral context beyond what's obvious. Adequate but no surplus value.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, directly conveys purpose. No superfluous words. Maximally concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool is simple with zero parameters, annotations present, and no output schema. Description suffices for complete understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters, schema coverage 100%. Baseline 4 is appropriate; description has no need to elaborate on params.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the tool checks authentication and readiness. Verb 'Check' with resource 'auth status' is specific. No sibling tool duplicates this purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use vs alternatives (e.g., ping). Lacks context like 'use before sending messages to ensure readiness' or not-to-use scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/loglux/whatsapp-mcp-stream'

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