get_upstream_dataset_events
Retrieve dataset events for a specific DAG run in Apache Airflow to monitor data dependencies and track upstream data availability.
Instructions
Get dataset events for a DAG run
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dag_id | Yes | ||
| dag_run_id | Yes |
Input Schema (JSON Schema)
{
"properties": {
"dag_id": {
"title": "Dag Id",
"type": "string"
},
"dag_run_id": {
"title": "Dag Run Id",
"type": "string"
}
},
"required": [
"dag_id",
"dag_run_id"
],
"type": "object"
}
Implementation Reference
- src/airflow/dagrun.py:223-227 (handler)The main handler function for the 'get_upstream_dataset_events' tool. It calls the Airflow DAGRunApi to retrieve upstream dataset events for the specified DAG run and returns the response as text content.async def get_upstream_dataset_events( dag_id: str, dag_run_id: str ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]: response = dag_run_api.get_upstream_dataset_events(dag_id=dag_id, dag_run_id=dag_run_id) return [types.TextContent(type="text", text=str(response.to_dict()))]
- src/airflow/dagrun.py:17-29 (registration)The registration of the 'get_upstream_dataset_events' tool within the list of DAG run related tools returned by get_all_functions(), which is used for MCP tool registration.def get_all_functions() -> list[tuple[Callable, str, str, bool]]: """Return list of (function, name, description, is_read_only) tuples for registration.""" return [ (post_dag_run, "post_dag_run", "Trigger a DAG by ID", False), (get_dag_runs, "get_dag_runs", "Get DAG runs by ID", True), (get_dag_runs_batch, "get_dag_runs_batch", "List DAG runs (batch)", True), (get_dag_run, "get_dag_run", "Get a DAG run by DAG ID and DAG run ID", True), (update_dag_run_state, "update_dag_run_state", "Update a DAG run state by DAG ID and DAG run ID", False), (delete_dag_run, "delete_dag_run", "Delete a DAG run by DAG ID and DAG run ID", False), (clear_dag_run, "clear_dag_run", "Clear a DAG run", False), (set_dag_run_note, "set_dag_run_note", "Update the DagRun note", False), (get_upstream_dataset_events, "get_upstream_dataset_events", "Get dataset events for a DAG run", True), ]