Skip to main content
Glama

trigger_dag

Initiate a new DAG run in Apache Airflow by specifying the DAG ID. Provides run details like ID, state, execution date, start, and end times via the MCP-Airflow-API.

Instructions

[Tool Role]: Triggers a new DAG run for a specified Airflow DAG.

Args: dag_id: The DAG ID to trigger

Returns: Minimal info about triggered DAG run: dag_id, run_id, state, execution_date, start_date, end_date

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dag_idYes

Implementation Reference

  • The core handler implementation for the 'trigger_dag' tool. It validates the dag_id, makes a POST request to the Airflow API to trigger a new DAG run with empty config, and returns details of the triggered run including run_id, state, and dates.
    @mcp.tool() async def trigger_dag(dag_id: str) -> Dict[str, Any]: """[Tool Role]: Triggers a new DAG run for a specified Airflow DAG.""" if not dag_id: raise ValueError("dag_id must not be empty") resp = await airflow_request("POST", f"/dags/{dag_id}/dagRuns", json={"conf": {}}) resp.raise_for_status() run = resp.json() return { "dag_id": dag_id, "run_id": run.get("run_id"), "state": run.get("state"), "execution_date": run.get("execution_date"), "start_date": run.get("start_date"), "end_date": run.get("end_date") }
  • v1 API specific registration function that sets the v1 airflow_request function and calls register_common_tools(mcp), which registers the trigger_dag tool.
    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)")
  • v2 API specific registration function that sets the v2 airflow_request function and calls register_common_tools(mcp), which registers the trigger_dag tool.
    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)

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