Skip to main content
Glama

wait_until_ready

Ensures WhatsApp Web is fully authenticated and operational before proceeding with chat automation tasks.

Instructions

Wait until WhatsApp Web is fully authenticated and ready for use.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timeout_secondsNo

Implementation Reference

  • The core logic for checking if WhatsApp Web is ready, including timeout handling and state detection.
    async def wait_until_ready(self, timeout_seconds: int | None = None) -> dict[str, Any]:
        await self.ensure_started()
        timeout = timeout_seconds or self.settings.startup_timeout_seconds
        deadline = asyncio.get_running_loop().time() + timeout
    
        while asyncio.get_running_loop().time() < deadline:
            state = await self._detect_state()
            if state == "ready":
                return {"state": state, "ready": True}
            await asyncio.sleep(2)
    
        state = await self._detect_state()
        return {
            "state": state,
            "ready": state == "ready",
            "message": "WhatsApp Web did not become ready before timeout.",
        }
  • Registration of the 'wait_until_ready' tool within the MCP server.
    "wait_until_ready": ToolDefinition(
        name="wait_until_ready",
        description="Wait until WhatsApp Web is fully authenticated and ready for use.",
        input_schema={
            "type": "object",
            "properties": {
                "timeout_seconds": {"type": "integer", "minimum": 5, "maximum": 600},
            },
            "additionalProperties": False,
        },
        handler=lambda args: self.client.wait_until_ready(args.get("timeout_seconds")),
    ),

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/ekaksher/whatsapp-mcp'

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