Skip to content
Shell
783 B
Raw Blame
#!/bin/bash
# Browser Automation Check Hook
# Automatically ensures Comet is running with debugging when browser tools are used

# Only run for browser-related MCP tools
if [[ "$TOOL_NAME" == mcp__plugin_testing-suite_playwright-server__* ]]; then
    # Check if debugging port is available
    if ! lsof -i :9222 >/dev/null 2>&1; then
        echo "🔍 Browser automation detected - ensuring Comet is running with debugging..."
        ~/mcp-comet-bridge/check-and-launch.sh

        # Give it a moment to fully start
        sleep 3

        # Verify it worked
        if lsof -i :9222 >/dev/null 2>&1; then
            echo "✅ Comet ready for automation"
        else
            echo "⚠️  Comet launched but still initializing - please wait a moment"
        fi
    fi
fi