get_dag_source
Retrieve DAG source code from Amazon MWAA environments to inspect, debug, or analyze Airflow workflow definitions.
Instructions
Get the source code of a DAG.
Args: environment_name: Name of the MWAA environment dag_id: The DAG ID
Returns: Dictionary containing the DAG source code
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| environment_name | Yes | ||
| dag_id | Yes |
Implementation Reference
- awslabs/mwaa_mcp_server/tools.py:279-283 (handler)The actual implementation of the tool, calling the Airflow API.
async def get_dag_source(self, environment_name: str, dag_id: str) -> Dict[str, Any]: """Get DAG source code via Airflow API.""" return self._invoke_airflow_api( environment_name, "GET", f"/dags/{dag_id}/dagSource" ) - awslabs/mwaa_mcp_server/server.py:295-309 (registration)The MCP tool registration and server-side wrapper for get_dag_source.
@mcp.tool(name="get_dag_source") async def get_dag_source( environment_name: str, dag_id: str, ) -> Dict[str, Any]: """Get the source code of a DAG. Args: environment_name: Name of the MWAA environment dag_id: The DAG ID Returns: Dictionary containing the DAG source code """ return await tools.get_dag_source(environment_name, dag_id)