Skip to main content
Glama

failed_dags

Identify and list recently failed DAG runs in Apache Airflow clusters to monitor workflow execution issues and facilitate troubleshooting.

Instructions

[Tool Role]: Lists all recently failed DAG runs in the Airflow cluster.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function implementing the 'failed_dags' tool. It performs an API request to fetch recently failed DAG runs (state=failed, limit=1000, ordered by start_date descending), processes the response to extract key run information, and returns a structured dictionary with the list of failed runs, total count, and query metadata.
    @mcp.tool()
    async def failed_dags() -> Dict[str, Any]:
        """[Tool Role]: Lists all recently failed DAG runs in the Airflow cluster."""
        resp = await airflow_request("GET", "/dags/~/dagRuns?state=failed&limit=1000&order_by=-start_date")
        resp.raise_for_status()
        data = resp.json()
    
        failed_runs = []
        for run in data.get("dag_runs", []):
            run_info = {
                "dag_id": run.get("dag_id"),
                "dag_display_name": run.get("dag_display_name"),
                "run_id": run.get("run_id"),
                "run_type": run.get("run_type"),
                "state": run.get("state"),
                "execution_date": run.get("execution_date"),
                "start_date": run.get("start_date"),
                "end_date": run.get("end_date"),
                "data_interval_start": run.get("data_interval_start"),
                "data_interval_end": run.get("data_interval_end"),
                "external_trigger": run.get("external_trigger"),
                "conf": run.get("conf"),
                "note": run.get("note")
            }
            failed_runs.append(run_info)
    
        return {
            "dag_runs": failed_runs,
            "total_failed": len(failed_runs),
            "query_info": {
                "state_filter": "failed",
                "limit": 1000,
                "order_by": "start_date (descending)"
            }
        }
  • Registration entry point for v1 API tools. Sets the v1-specific airflow_request function and calls register_common_tools(mcp), which defines and registers the failed_dags tool using the @mcp.tool() decorator.
    def register_tools(mcp):
        """Register v1 tools by importing common tools with v1 request function."""
        
        logger.info("Initializing MCP server for Airflow API v1")
        logger.info("Loading Airflow API v1 tools (Airflow 2.x)")
        
        # Set the global request function to v1
        common_tools.airflow_request = airflow_request_v1
        
        # Register all 56 common tools (includes management tools)
        common_tools.register_common_tools(mcp)
        
        # V1 has no exclusive tools - all tools are shared with v2
        
        logger.info("Registered all Airflow API v1 tools (56 tools: 43 core + 13 management tools)")
  • Registration entry point for v2 API tools. Sets the v2-specific airflow_request function and calls register_common_tools(mcp), which defines and registers the failed_dags tool using the @mcp.tool() decorator. Also registers v2-exclusive asset tools.
    def register_tools(mcp):
        """Register v2 tools: common tools + v2-exclusive asset tools."""
        
        logger.info("Initializing MCP server for Airflow API v2")
        logger.info("Loading Airflow API v2 tools (Airflow 3.0+)")
        
        # Set the global request function to v2
        common_tools.airflow_request = airflow_request_v2
        
        # Register all 43 common tools
        common_tools.register_common_tools(mcp)
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool lists failed DAG runs but does not cover aspects like authentication needs, rate limits, pagination, or what 'recently' means in terms of time range. This leaves significant gaps for a tool that likely queries operational data.

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 a single, efficient sentence that front-loads the core purpose without any wasted words. It uses a '[Tool Role]' prefix to immediately clarify intent, making it highly structured and concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 0 parameters, an output schema exists, and no annotations are provided, the description is minimally adequate. However, for a tool that likely returns failure data in a cluster environment, it lacks details on output format, error handling, or operational context (e.g., time recency definition), leaving room for improvement.

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 0 parameters with 100% schema description coverage, so no parameter documentation is needed. The description appropriately does not discuss parameters, earning a baseline score of 4 for not adding unnecessary information.

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 specific action ('Lists') and resource ('all recently failed DAG runs in the Airflow cluster'), distinguishing it from siblings like 'all_dag_event_summary' or 'running_dags' by focusing exclusively on failed runs.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives like 'list_task_instances_all' or 'get_event_log', which might also surface failure information. The description implies a specific use case but lacks explicit comparisons or exclusions.

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/call518/MCP-Airflow-API'

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