Skip to main content
Glama

dune_health_check

Validate Dune API key configuration and logging setup to ensure proper connectivity for blockchain data analysis workflows.

Instructions

Validate Dune API key presence and logging setup.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registers the 'dune_health_check' tool using the FastMCP @app.tool decorator with name, title, description, and tags.
    @app.tool( name="dune_health_check", title="Health Check", description="Validate Dune API key presence and logging setup.", tags={"health"}, )
  • The handler function for the dune_health_check tool, which calls the compute_health_status helper to return the health status dictionary.
    def dune_health_check() -> dict[str, Any]: return compute_health_status()
  • Implements the core logic for computing health status: checks Dune API key (loading .env if needed), query history setup, and optionally verifies a template query via Dune API.
    def compute_health_status() -> dict[str, Any]: """Compute a lightweight health status without requiring full init.""" if not os.getenv("DUNE_API_KEY"): _best_effort_load_dotenv() has_api_key = bool(os.getenv("DUNE_API_KEY") or (CONFIG and CONFIG.dune.api_key)) qh = QUERY_HISTORY if QUERY_HISTORY is not None else QueryHistory.from_env() history_path = getattr(qh, "history_path", None) status: dict[str, Any] = { "api_key_present": has_api_key, "query_history_path": str(history_path) if history_path else None, "logging_enabled": qh is not None, "status": "ok" if has_api_key else "degraded", } # Optional: check raw SQL template query health if configured try: tmpl = os.getenv("SPICE_RAW_SQL_QUERY_ID") if tmpl: tid = dune_urls.get_query_id(tmpl) url = dune_urls.url_templates["query"].format(query_id=tid) from ..adapters.dune.user_agent import get_user_agent as get_dune_user_agent headers = { "X-Dune-API-Key": os.getenv("DUNE_API_KEY", ""), "User-Agent": get_dune_user_agent(), } client = HTTP_CLIENT or HttpClient(Config.from_env().http) resp = client.request("GET", url, headers=headers, timeout=5.0) status["template_query_id"] = tid status["template_query_ok"] = resp.status_code == 200 except Exception: pass return status

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/Evan-Kim2028/spice-mcp'

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