Skip to main content
Glama

MCP Server Airflow Token

get_dag_run

Retrieve specific DAG run details from Apache Airflow using DAG ID and run ID to monitor workflow execution status and access run information.

Instructions

Get a DAG run by DAG ID and DAG run ID

Input Schema

NameRequiredDescriptionDefault
dag_idYes
dag_run_idYes

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

  • The primary handler function implementing the 'get_dag_run' tool logic. It calls the Airflow DAGRunApi to fetch the specific DAG run, enhances the response with a UI URL using the helper function, and returns it formatted as MCP TextContent.
    async def get_dag_run( dag_id: str, dag_run_id: str ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]: response = dag_run_api.get_dag_run(dag_id=dag_id, dag_run_id=dag_run_id) # Convert response to dictionary for easier manipulation response_dict = response.to_dict() # Add UI link to DAG run response_dict["ui_url"] = get_dag_run_url(dag_id, dag_run_id) return [types.TextContent(type="text", text=str(response_dict))]
  • Registration function listing all DAG run related tools, including 'get_dag_run' with its name, description, and read-only flag.
    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), ]
  • Helper utility to construct the UI URL for a specific DAG run, used in the handler and other functions.
    def get_dag_run_url(dag_id: str, dag_run_id: str) -> str: return f"{AIRFLOW_HOST}/dags/{dag_id}/grid?dag_run_id={dag_run_id}"

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/nikhil-ganage/mcp-server-airflow-token'

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