Skip to main content
Glama

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
NameRequiredDescriptionDefault
environment_nameYes
dag_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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"
        )
  • 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)
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Without annotations, the description must carry the full burden. It discloses the return type ('Dictionary containing the DAG source code'), but omits critical behavioral details such as authentication requirements, rate limits, or whether the source code is returned as a string or file object.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The docstring-style structure with Args and Returns sections is appropriate and well-organized. Each sentence earns its place without excessive verbosity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simple 2-parameter input and presence of a Returns section, the description is sufficiently complete for a read-only operation, though mentioning MWAA context earlier and error scenarios would improve it.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The Args section compensates for the 0% schema description coverage by providing semantic meaning for both parameters ('Name of the MWAA environment', 'The DAG ID'), though it could further clarify formatting constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Get') and resource ('source code of a DAG'), clearly distinguishing it from the sibling 'get_dag' tool which likely returns metadata rather than actual code.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get_dag', nor does it mention prerequisites such as requiring DAG deployment or specific permissions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/paschmaria/mwaa-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server