check_system_dependencies
Verify all required system dependencies are installed for Auto-Snap MCP, ensuring seamless server functionality. Results are returned in JSON format.
Instructions
Check if all required system dependencies are installed.
Returns:
JSON string with dependency check results.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.py:567-606 (handler)The primary handler for the 'check_system_dependencies' tool, registered via @mcp.tool(). It invokes helper functions to check for wmctrl, xdotool, and tesseract, then constructs and returns a JSON response with status, availability, missing deps, and install instructions.@mcp.tool() async def check_system_dependencies() -> str: """ Check if all required system dependencies are installed. Returns: JSON string with dependency check results. """ try: missing_deps = check_dependencies() tesseract_available = check_tesseract() result = { "status": "success", "dependencies": { "wmctrl": "wmctrl" not in missing_deps, "xdotool": "xdotool" not in missing_deps, "tesseract": tesseract_available }, "missing_dependencies": missing_deps, "install_commands": { "wmctrl": "sudo apt-get install wmctrl", "xdotool": "sudo apt-get install xdotool", "tesseract": "sudo apt-get install tesseract-ocr" } } if missing_deps or not tesseract_available: result["status"] = "warning" result["message"] = "Some dependencies are missing" return json.dumps(result, indent=2) except Exception as e: logger.error(f"Failed to check dependencies: {e}") return json.dumps({ "status": "error", "error": str(e) })
- capture.py:1655-1674 (helper)Supporting utility that verifies the presence of Linux window management tools 'wmctrl' and 'xdotool' by executing their version commands.def check_dependencies() -> List[str]: """ Check if required system dependencies are installed. Returns list of missing dependencies. """ missing = [] # Check for wmctrl try: subprocess.run(['wmctrl', '--version'], capture_output=True, check=True, timeout=5) except (subprocess.CalledProcessError, FileNotFoundError, subprocess.TimeoutExpired): missing.append('wmctrl') # Check for xdotool try: subprocess.run(['xdotool', '--version'], capture_output=True, check=True, timeout=5) except (subprocess.CalledProcessError, FileNotFoundError, subprocess.TimeoutExpired): missing.append('xdotool') return missing
- processing.py:244-269 (helper)Supporting utility that checks Tesseract OCR availability using pytesseract.get_tesseract_version() with a 10-second timeout to prevent hangs.def check_tesseract() -> bool: """ Check if Tesseract OCR is installed and accessible. Returns: True if Tesseract is available, False otherwise """ try: import signal def timeout_handler(signum, frame): raise TimeoutError("Tesseract check timed out") # Set timeout for tesseract check signal.signal(signal.SIGALRM, timeout_handler) signal.alarm(10) # 10 second timeout try: pytesseract.get_tesseract_version() return True finally: signal.alarm(0) # Cancel the alarm except (TimeoutError, Exception) as e: logger.error(f"Tesseract not available: {e}") return False