Skip to main content
Glama
WhiteNightShadow

camoufox-reverse-mcp

check_environment

Verifies MCP version, critical dependencies, and browser residuals to ensure environment integrity. Returns a report with overall status and recommendations.

Instructions

One-stop self-check of MCP environment, dependencies, and browser state.

v1.0.0: session-related checks removed (session mechanism removed). Checks MCP version, critical dependencies (esprima, playwright), browser state (residuals, captures).

Returns: dict with sections: mcp, deps, browser, overall_ok, recommendations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Main handler for the check_environment tool. Performs a one-stop self-check of MCP version, critical dependencies (esprima, playwright), browser state (residuals, captures), and custom camoufox-reverse browser detection. Returns a dict with sections: mcp, deps, browser, camoufox_reverse, overall_ok, and recommendations.
    @mcp.tool()
    async def check_environment() -> dict:
        """One-stop self-check of MCP environment, dependencies, and browser state.
    
        v1.0.0: session-related checks removed (session mechanism removed).
        Checks MCP version, critical dependencies (esprima, playwright),
        browser state (residuals, captures).
    
        Returns:
            dict with sections: mcp, deps, browser, overall_ok, recommendations.
        """
        recommendations: list[str] = []
    
        # MCP version
        try:
            mod = importlib.import_module("camoufox_reverse_mcp")
            version = getattr(mod, "__version__", "unknown")
            parts = tuple(int(x) for x in version.split(".") if x.isdigit())
            version_ok = parts >= (1, 0, 0)
        except Exception:
            version = "unknown"
            version_ok = False
        if not version_ok:
            recommendations.append(f"MCP version is {version}, need >= 1.0.0.")
    
        # Dependencies
        deps: dict[str, dict] = {}
        for dep in ("esprima", "playwright"):
            try:
                m = importlib.import_module(dep)
                deps[dep] = {"installed": True, "version": getattr(m, "__version__", "unknown"), "ok": True}
            except ImportError:
                deps[dep] = {"installed": False, "version": None, "ok": False}
    
        # Browser state
        browser_state: dict[str, Any] = {"running": False}
        try:
            if browser_manager.browser is not None:
                browser_state["running"] = True
                ctx = browser_manager.contexts.get("default")
                pages = ctx.pages if ctx else []
                browser_state["page_count"] = len(pages)
                browser_state["persistent_scripts_count"] = len(browser_manager._persistent_scripts)
                browser_state["active_captures"] = browser_manager._capturing
                browser_state["captured_requests_count"] = len(browser_manager._network_requests)
                has_residuals = (
                    browser_state["persistent_scripts_count"] > 0
                    or browser_state["captured_requests_count"] > 0
                )
                browser_state["has_residuals"] = has_residuals
                if has_residuals:
                    recommendations.append("Browser has residual state. Consider reset_browser_state().")
        except Exception as e:
            browser_state["error"] = str(e)
    
        overall_ok = version_ok and all(d["ok"] for d in deps.values() if d.get("installed"))
    
        # camoufox-reverse custom browser detection
        from ..property_trace import CACHE_DIR, CONTROL_DIR, TRACES_DIR
        custom_browser: dict[str, Any] = {"installed": False}
        try:
            # Check if trace control files exist (= custom browser running with trace)
            ctrl_files = list(CONTROL_DIR.glob("control-*.cmd")) if CONTROL_DIR.exists() else []
            trace_files = list(TRACES_DIR.glob("*.jsonl")) if TRACES_DIR.exists() else []
            if ctrl_files:
                custom_browser = {
                    "installed": True,
                    "trace_active": True,
                    "control_files": len(ctrl_files),
                    "trace_files": len(trace_files),
                    "cache_dir": str(CACHE_DIR),
                }
            else:
                custom_browser = {
                    "installed": False,
                    "install_hint": (
                        "Download camoufox-reverse from "
                        "https://github.com/WhiteNightShadow/camoufox-reverse/releases "
                        "and launch with enable_trace=True"
                    ),
                }
        except Exception:
            pass
    
        return {
            "mcp": {"version": version, "version_ok": version_ok},
            "deps": deps,
            "browser": browser_state,
            "camoufox_reverse": custom_browser,
            "overall_ok": overall_ok,
            "recommendations": recommendations,
        }
  • The return type is a plain dict (no explicit Pydantic schema). The tool returns mcp version info, dependency status, browser state, camoufox_reverse custom browser info, overall_ok boolean, and recommendations list.
    async def check_environment() -> dict:
        """One-stop self-check of MCP environment, dependencies, and browser state.
    
        v1.0.0: session-related checks removed (session mechanism removed).
        Checks MCP version, critical dependencies (esprima, playwright),
        browser state (residuals, captures).
    
        Returns:
            dict with sections: mcp, deps, browser, overall_ok, recommendations.
        """
        recommendations: list[str] = []
    
        # MCP version
        try:
            mod = importlib.import_module("camoufox_reverse_mcp")
            version = getattr(mod, "__version__", "unknown")
            parts = tuple(int(x) for x in version.split(".") if x.isdigit())
            version_ok = parts >= (1, 0, 0)
        except Exception:
            version = "unknown"
            version_ok = False
        if not version_ok:
            recommendations.append(f"MCP version is {version}, need >= 1.0.0.")
    
        # Dependencies
        deps: dict[str, dict] = {}
        for dep in ("esprima", "playwright"):
            try:
                m = importlib.import_module(dep)
                deps[dep] = {"installed": True, "version": getattr(m, "__version__", "unknown"), "ok": True}
            except ImportError:
                deps[dep] = {"installed": False, "version": None, "ok": False}
    
        # Browser state
        browser_state: dict[str, Any] = {"running": False}
        try:
            if browser_manager.browser is not None:
                browser_state["running"] = True
                ctx = browser_manager.contexts.get("default")
                pages = ctx.pages if ctx else []
                browser_state["page_count"] = len(pages)
                browser_state["persistent_scripts_count"] = len(browser_manager._persistent_scripts)
                browser_state["active_captures"] = browser_manager._capturing
                browser_state["captured_requests_count"] = len(browser_manager._network_requests)
                has_residuals = (
                    browser_state["persistent_scripts_count"] > 0
                    or browser_state["captured_requests_count"] > 0
                )
                browser_state["has_residuals"] = has_residuals
                if has_residuals:
                    recommendations.append("Browser has residual state. Consider reset_browser_state().")
        except Exception as e:
            browser_state["error"] = str(e)
    
        overall_ok = version_ok and all(d["ok"] for d in deps.values() if d.get("installed"))
    
        # camoufox-reverse custom browser detection
        from ..property_trace import CACHE_DIR, CONTROL_DIR, TRACES_DIR
        custom_browser: dict[str, Any] = {"installed": False}
        try:
            # Check if trace control files exist (= custom browser running with trace)
            ctrl_files = list(CONTROL_DIR.glob("control-*.cmd")) if CONTROL_DIR.exists() else []
            trace_files = list(TRACES_DIR.glob("*.jsonl")) if TRACES_DIR.exists() else []
            if ctrl_files:
                custom_browser = {
                    "installed": True,
                    "trace_active": True,
                    "control_files": len(ctrl_files),
                    "trace_files": len(trace_files),
                    "cache_dir": str(CACHE_DIR),
                }
            else:
                custom_browser = {
                    "installed": False,
                    "install_hint": (
                        "Download camoufox-reverse from "
                        "https://github.com/WhiteNightShadow/camoufox-reverse/releases "
                        "and launch with enable_trace=True"
                    ),
                }
        except Exception:
            pass
    
        return {
            "mcp": {"version": version, "version_ok": version_ok},
            "deps": deps,
            "browser": browser_state,
            "camoufox_reverse": custom_browser,
            "overall_ok": overall_ok,
            "recommendations": recommendations,
        }
  • The tool module is imported in server.py (line 23), which triggers the @mcp.tool() decorator registration on the FastMCP instance.
    from .tools import environment      # noqa: E402, F401  — check_environment
  • get_deprecation_log() is a helper referenced by check_environment for reporting recent deprecation calls.
    def get_deprecation_log() -> list[dict]:
        """Return recent deprecation calls (for check_environment reporting)."""
        return list(_GLOBAL_DEPRECATION_LOG)
Behavior4/5

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

With no annotations, the description carries the full burden. It discloses the tool's read-like behavior (checking, no side effects implied) and details the return value sections (mcp, deps, browser, overall_ok, recommendations). It also notes version changes (session checks removed). However, it does not explicitly state that it is non-destructive.

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?

The description is concise: two sentences plus a structured list of return sections. It front-loads the purpose and includes relevant version history. Every sentence contributes value without redundancy.

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?

Given zero parameters, no output schema, and no annotations, the description provides sufficient context: what is checked, the return structure, and a version note. It is complete for the agent to understand and invoke the tool correctly.

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?

The tool has zero parameters, and the schema coverage is 100% (empty). Per guidelines, the baseline is 4. The description adds value by explaining the output structure but cannot add parameter semantics since there are none.

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?

The description clearly states the tool's verb ('check') and resource ('MCP environment, dependencies, and browser state'). It lists specific components checked (MCP version, dependencies like esprima and playwright, browser state) and distinguishes it from sibling tools like 'compare_env' by focusing on a self-check rather than comparison.

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

Usage Guidelines3/5

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

The description implies the tool is for initial diagnostics but provides no explicit guidance on when to use it versus alternatives like 'reset_browser_state' or 'compare_env'. The context is implicit, lacking when-to-use or when-not-to-use instructions.

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/WhiteNightShadow/camoufox-reverse-mcp'

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