list_tasks
Retrieve all tasks from a specific Apache Airflow DAG to inspect workflow components and monitor task execution status.
Instructions
[Tool Role]: Lists all tasks within the specified DAG.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dag_id | Yes |
Implementation Reference
- The core handler function for the 'list_tasks' tool. Decorated with @mcp.tool(), it fetches and returns all tasks for the specified DAG ID using the Airflow REST API endpoint /dags/{dag_id}/tasks.@mcp.tool() async def list_tasks(dag_id: str) -> Dict[str, Any]: """[Tool Role]: Lists all tasks within the specified DAG.""" if not dag_id: raise ValueError("dag_id must not be empty") resp = await airflow_request("GET", f"/dags/{dag_id}/tasks") resp.raise_for_status() return resp.json()
- src/mcp_airflow_api/tools/v1_tools.py:19-24 (registration)v1 API version registration: configures the airflow_request function for v1 API and invokes register_common_tools(mcp), which executes the code defining the @mcp.tool()-decorated list_tasks handler.# 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)
- src/mcp_airflow_api/tools/v2_tools.py:20-24 (registration)v2 API version registration: configures the airflow_request function for v2 API and invokes register_common_tools(mcp), which executes the code defining the @mcp.tool()-decorated list_tasks handler.# 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)