Skip to main content
Glama
nikhil-ganage

MCP Server Airflow Token

get_dag_runs

Retrieve DAG run details by ID with filtering options for execution dates, states, and pagination to monitor Airflow workflow execution.

Instructions

Get DAG runs by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dag_idYes
limitNo
offsetNo
execution_date_gteNo
execution_date_lteNo
start_date_gteNo
start_date_lteNo
end_date_gteNo
end_date_lteNo
updated_at_gteNo
updated_at_lteNo
stateNo
order_byNo

Implementation Reference

  • The primary handler function implementing the 'get_dag_runs' tool. It accepts various filters, calls the Airflow DAGRunApi, adds UI URLs to the response, and returns formatted text content.
    async def get_dag_runs(
        dag_id: str,
        limit: Optional[int] = None,
        offset: Optional[int] = None,
        execution_date_gte: Optional[str] = None,
        execution_date_lte: Optional[str] = None,
        start_date_gte: Optional[str] = None,
        start_date_lte: Optional[str] = None,
        end_date_gte: Optional[str] = None,
        end_date_lte: Optional[str] = None,
        updated_at_gte: Optional[str] = None,
        updated_at_lte: Optional[str] = None,
        state: Optional[List[str]] = None,
        order_by: Optional[str] = None,
    ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]:
        # Build parameters dictionary
        kwargs: Dict[str, Any] = {}
        if limit is not None:
            kwargs["limit"] = limit
        if offset is not None:
            kwargs["offset"] = offset
        if execution_date_gte is not None:
            kwargs["execution_date_gte"] = execution_date_gte
        if execution_date_lte is not None:
            kwargs["execution_date_lte"] = execution_date_lte
        if start_date_gte is not None:
            kwargs["start_date_gte"] = start_date_gte
        if start_date_lte is not None:
            kwargs["start_date_lte"] = start_date_lte
        if end_date_gte is not None:
            kwargs["end_date_gte"] = end_date_gte
        if end_date_lte is not None:
            kwargs["end_date_lte"] = end_date_lte
        if updated_at_gte is not None:
            kwargs["updated_at_gte"] = updated_at_gte
        if updated_at_lte is not None:
            kwargs["updated_at_lte"] = updated_at_lte
        if state is not None:
            kwargs["state"] = state
        if order_by is not None:
            kwargs["order_by"] = order_by
    
        response = dag_run_api.get_dag_runs(dag_id=dag_id, **kwargs)
    
        # Convert response to dictionary for easier manipulation
        response_dict = response.to_dict()
    
        # Add UI links to each DAG run
        for dag_run in response_dict.get("dag_runs", []):
            dag_run["ui_url"] = get_dag_run_url(dag_id, dag_run["dag_run_id"])
    
        return [types.TextContent(type="text", text=str(response_dict))]
  • Module-level registration function that includes the tuple for 'get_dag_runs' tool, providing the handler reference, name, description, and read-only flag.
    def get_all_functions() -> list[tuple[Callable, str, str, bool]]:
        """Return list of (function, name, description, is_read_only) tuples for registration."""
        return [
            (post_dag_run, "post_dag_run", "Trigger a DAG by ID", False),
            (get_dag_runs, "get_dag_runs", "Get DAG runs by ID", True),
            (get_dag_runs_batch, "get_dag_runs_batch", "List DAG runs (batch)", True),
            (get_dag_run, "get_dag_run", "Get a DAG run by DAG ID and DAG run ID", True),
            (update_dag_run_state, "update_dag_run_state", "Update a DAG run state by DAG ID and DAG run ID", False),
            (delete_dag_run, "delete_dag_run", "Delete a DAG run by DAG ID and DAG run ID", False),
            (clear_dag_run, "clear_dag_run", "Clear a DAG run", False),
            (set_dag_run_note, "set_dag_run_note", "Update the DagRun note", False),
            (get_upstream_dataset_events, "get_upstream_dataset_events", "Get dataset events for a DAG run", True),
        ]
  • src/main.py:78-92 (registration)
    Top-level MCP server tool registration loop in main.py that calls get_dagrun_functions() (via APIType.DAGRUN mapping) and registers each tool, including 'get_dag_runs', using app.add_tool().
    for api in apis:
        logging.debug(f"Adding API: {api}")
        get_function = APITYPE_TO_FUNCTIONS[APIType(api)]
        try:
            functions = get_function()
        except NotImplementedError:
            continue
    
        # Filter functions for read-only mode if requested
        if read_only:
            functions = filter_functions_for_read_only(functions)
    
        for func, name, description, *_ in functions:
            app.add_tool(func, name=name, description=description)
  • Helper utility to generate the Airflow UI URL for a specific DAG run, used within the get_dag_runs handler to enhance the response.
    def get_dag_run_url(dag_id: str, dag_run_id: str) -> str:
        return f"{AIRFLOW_HOST}/dags/{dag_id}/grid?dag_run_id={dag_run_id}"
Behavior1/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. The description reveals nothing about whether this is a read-only operation, whether it has side effects, what permissions are required, rate limits, pagination behavior (despite having limit/offset parameters), or what format the results will be in. For a tool with 13 parameters and no annotation coverage, this is a significant gap in behavioral context.

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 extremely concise at just 4 words. While this represents under-specification rather than ideal conciseness, according to the scoring rules, conciseness focuses on appropriate sizing and front-loading. The description wastes no words and gets straight to the point, even if that point is insufficiently informative.

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

Completeness1/5

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

Given the complexity (13 parameters, no annotations, no output schema), the description is completely inadequate. It doesn't explain what the tool returns, how to interpret the numerous filtering parameters, what DAG runs are in this context, or any behavioral characteristics. For a data retrieval tool with extensive filtering options, this minimal description fails to provide the context needed for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, meaning none of the 13 parameters have descriptions in the schema. The tool description mentions 'by ID' which only hints at the 'dag_id' parameter, leaving 12 other parameters completely undocumented. The description fails to explain what parameters like 'execution_date_gte', 'state', or 'order_by' do, what values they accept, or how they affect the query. With low schema coverage, the description should compensate but doesn't.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Get DAG runs by ID' is a tautology that essentially restates the tool name 'get_dag_runs'. It specifies the verb 'Get' and resource 'DAG runs', but lacks specificity about what 'by ID' means (the schema shows dag_id is required, but the description doesn't clarify this is filtering by DAG identifier). It doesn't distinguish this tool from sibling tools like 'get_dag_run' (singular) or 'get_dag_runs_batch'.

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

Usage Guidelines1/5

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

The description provides no guidance on when to use this tool versus alternatives. With multiple sibling tools like 'get_dag_run', 'get_dag_runs_batch', and 'get_dag_details', there's no indication of when this specific filtering/list tool is appropriate versus those other options. No prerequisites, exclusions, or comparative context is mentioned.

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/nikhil-ganage/mcp-server-airflow-token'

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