delete_dag
Use this tool to remove a specific DAG (Directed Acyclic Graph) from Apache Airflow by specifying the DAG ID. Streamlines DAG cleanup and management within the MCP Server for Apache Airflow ecosystem.
Instructions
Delete a DAG
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dag_id | Yes |
Implementation Reference
- src/airflow/dag.py:169-171 (handler)The primary handler function for the "delete_dag" tool. It accepts a `dag_id` parameter, invokes the Airflow `dag_api.delete_dag` method, and returns the API response as MCP TextContent.async def delete_dag(dag_id: str) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]: response = dag_api.delete_dag(dag_id=dag_id) return [types.TextContent(type="text", text=str(response.to_dict()))]
- src/airflow/dag.py:29-29 (registration)The specific registration entry for "delete_dag" in the module's `get_all_functions()` list, including the function reference, tool name, description, and read-only flag (False). This is collected for top-level registration.(delete_dag, "delete_dag", "Delete a DAG", False),
- src/main.py:8-8 (registration)Top-level import of the `get_all_functions` from the dag module in the main MCP server file, enabling inclusion of "delete_dag" in the tool registry.from src.airflow.dag import get_all_functions as get_dag_functions
- src/main.py:95-96 (registration)The generic registration loop in main.py that adds all module functions, including "delete_dag", as MCP tools using `Tool.from_function`.for func, name, description, *_ in functions: app.add_tool(Tool.from_function(func, name=name, description=description))
- src/airflow/dag.py:12-12 (helper)Initialization of the `dag_api` client instance used by the "delete_dag" handler to interact with Airflow's DAG API.dag_api = DAGApi(api_client)