get_dag_details
Fetch a simplified representation of a DAG in Apache Airflow by specifying the DAG ID and optional fields, enabling streamlined DAG management and monitoring through the MCP Server interface.
Instructions
Get a simplified representation of DAG
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dag_id | Yes | ||
| fields | No |
Implementation Reference
- src/airflow/dag.py:91-100 (handler)The core handler function for the 'get_dag_details' tool. It accepts a required 'dag_id' string and optional 'fields' list of strings, constructs kwargs, calls the Airflow DAG API's get_dag_details method, and returns the response as a TextContent object.async def get_dag_details( dag_id: str, fields: Optional[List[str]] = None ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]: # Build parameters dictionary kwargs: Dict[str, Any] = {} if fields is not None: kwargs["fields"] = fields response = dag_api.get_dag_details(dag_id=dag_id, **kwargs) return [types.TextContent(type="text", text=str(response.to_dict()))]
- src/airflow/dag.py:20-20 (registration)The specific registration tuple for 'get_dag_details' within the module's get_all_functions() return list, including the handler function reference, tool name, description, and read-only flag (True). This list is imported and used by src/main.py to register tools with the MCP server.(get_dag_details, "get_dag_details", "Get a simplified representation of DAG", True),
- src/main.py:95-96 (registration)The generic registration loop in the main entrypoint where tools from all modules (including dag.py's get_dag_details) are added to the MCP app using Tool.from_function, respecting read-only filters.for func, name, description, *_ in functions: app.add_tool(Tool.from_function(func, name=name, description=description))