get-dag-source
Fetch the Python source code of an Airflow DAG by DAG ID from an Amazon MWAA environment. Works across Airflow 2.x and 3.x.
Instructions
Get the source code of a DAG file.
Returns the Python source code of the DAG. Works on both Airflow 2.x
and 3.x environments: on 3.x the source is fetched by DAG ID directly;
on 2.x the server resolves the DAG's file token first.
Args:
ctx: The MCP context.
environment_name: Name of the MWAA environment.
dag_id: The DAG identifier.
region: AWS region override.
profile_name: AWS CLI profile name override.
Returns:
CallToolResult with the DAG source code.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"dag_id": "<dag_id>"
},
"name": "get-dag-source"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dag_id | Yes | The DAG ID to get the source code for. | |
| region | No | AWS region override. | |
| profile_name | No | AWS CLI profile name override. | |
| environment_name | No | Name of the MWAA environment. If omitted and only one environment exists, it is used automatically. |