Skip to main content
Glama
yangkyeongmo

MCP Server for Apache Airflow

by yangkyeongmo

get_dag_stats

Retrieve statistics for Apache Airflow DAGs to monitor performance and status through the MCP Server for Apache Airflow.

Instructions

Get DAG stats

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dag_idsNo

Implementation Reference

  • The asynchronous handler function that executes the 'get_dag_stats' tool. It accepts an optional list of DAG IDs, calls the underlying Airflow DagStatsApi, and returns the stats as a text content response.
    async def get_dag_stats(
        dag_ids: Optional[List[str]] = None,
    ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]:
        # Build parameters dictionary
        kwargs: Dict[str, Any] = {}
        if dag_ids is not None:
            kwargs["dag_ids"] = dag_ids
    
        response = dag_stats_api.get_dag_stats(**kwargs)
        return [types.TextContent(type="text", text=str(response.to_dict()))]
  • Provides the registration tuple for the 'get_dag_stats' tool, which is used by the central registration in main.py to add the tool via app.add_tool.
    def get_all_functions() -> list[tuple[Callable, str, str, bool]]:
        """Return list of (function, name, description, is_read_only) tuples for registration."""
        return [
            (get_dag_stats, "get_dag_stats", "Get DAG stats", True),
        ]
  • src/main.py:95-96 (registration)
    The generic loop in the main entrypoint that registers all tools, including 'get_dag_stats', by calling Tool.from_function and adding to the MCP app.
    for func, name, description, *_ in functions:
        app.add_tool(Tool.from_function(func, name=name, description=description))
  • Imports and initializes the DagStatsApi instance using the shared api_client, which the handler uses to fetch DAG stats.
    import mcp.types as types
    from airflow_client.client.api.dag_stats_api import DagStatsApi
    
    from src.airflow.airflow_client import api_client
    
    dag_stats_api = DagStatsApi(api_client)
Behavior1/5

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

No annotations are provided, so the description must fully disclose behavioral traits. 'Get DAG stats' implies a read-only operation but fails to specify critical details: whether it requires authentication, has rate limits, returns real-time or historical data, or what format the output takes (e.g., JSON, summary statistics). This lack of transparency leaves the agent guessing about the tool's behavior and constraints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with just three words, which could be seen as efficient. However, it is under-specified rather than appropriately sized, as it lacks essential details needed for effective tool use. While front-loaded, it does not earn its place by adding value beyond the minimal statement.

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 tool's complexity (inferred from sibling tools involving DAG operations), lack of annotations, no output schema, and poor parameter documentation, the description is severely incomplete. It does not cover what stats are retrieved, how results are structured, or any behavioral aspects, making it inadequate for an agent to use the tool correctly in context.

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?

The input schema has 1 parameter (dag_ids) with 0% description coverage, meaning the schema provides no semantic information. The description 'Get DAG stats' does not mention parameters at all, failing to explain what dag_ids is (e.g., a list of DAG identifiers to filter stats), its optional nature, or how null values are handled. This leaves the parameter's purpose and usage completely undocumented.

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 stats' is a tautology that merely restates the tool name without elaboration. It specifies the verb 'Get' and resource 'DAG stats', but provides no details about what 'stats' entails (e.g., performance metrics, status counts, runtime information) or how it differs from sibling tools like get_dag, get_dag_details, or get_dag_runs. This leaves the purpose vague and indistinguishable from related tools.

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 offers no guidance on when to use this tool versus alternatives. It does not mention any context, prerequisites, or exclusions, such as whether it's for monitoring, debugging, or reporting, or how it compares to siblings like get_dag_runs or get_dag_details. Without such information, an agent cannot determine appropriate usage scenarios.

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/yangkyeongmo/mcp-server-apache-airflow'

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