check_claude_auth
Verify authentication status for Claude.ai sessions to monitor usage limits and track API consumption.
Instructions
Check if the current session is authenticated with Claude.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.py:256-266 (handler)Handler logic for 'check_claude_auth' tool, which checks browser authentication status.
elif name == "check_claude_auth": context = await get_browser_context() is_authenticated = await check_authenticated(context) return [TextContent( type="text", text=json.dumps({ "authenticated": is_authenticated, "auth_state_exists": AUTH_STATE_PATH.exists() }, indent=2) )] - server.py:211-219 (registration)Registration of the 'check_claude_auth' tool within the list_tools function.
name="check_claude_auth", description="Check if the current session is authenticated with Claude.", inputSchema={ "type": "object", "properties": {}, "required": [] } ) ] - server.py:66-80 (helper)Helper function used by 'check_claude_auth' to perform the actual authentication check using Playwright.
async def check_authenticated(context: BrowserContext) -> bool: """Check if current session is authenticated.""" page = await context.new_page() try: await page.goto(USAGE_URL, wait_until="domcontentloaded", timeout=60000) # Wait a bit for any redirects await page.wait_for_timeout(2000) # Check if we're on the usage page or redirected to login current_url = page.url return "settings/usage" in current_url and "login" not in current_url except Exception: return False finally: await page.close()