health_check
Retrieve Splunk connection status and list installed apps to monitor and manage system health effectively using the splunk-mcp server tool.
Instructions
Get basic Splunk connection information and list available apps
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- splunk_mcp.py:668-707 (handler)The main handler function for the 'health_check' MCP tool. It connects to Splunk using get_splunk_connection(), lists all available apps with their name, label, and version, and returns a health status dictionary including connection details and apps list. The @mcp.tool() decorator registers it as an MCP tool.@mcp.tool() async def health_check() -> Dict[str, Any]: """Get basic Splunk connection information and list available apps""" try: service = get_splunk_connection() logger.info("🏥 Performing health check...") # List available apps apps = [] for app in service.apps: try: app_info = { "name": app['name'], "label": app['label'], "version": app['version'] } apps.append(app_info) except Exception as e: logger.warning(f"⚠️ Error getting info for app {app['name']}: {str(e)}") continue response = { "status": "healthy", "connection": { "host": SPLUNK_HOST, "port": SPLUNK_PORT, "scheme": SPLUNK_SCHEME, "username": os.environ.get("SPLUNK_USERNAME", "admin"), "ssl_verify": VERIFY_SSL }, "apps_count": len(apps), "apps": apps } logger.info(f"✅ Health check successful. Found {len(apps)} apps") return response except Exception as e: logger.error(f"❌ Health check failed: {str(e)}") raise