Skip to main content
Glama
yangkyeongmo

MCP Server for Apache Airflow

by yangkyeongmo

update_dag_run_state

Change the execution status of an Apache Airflow DAG run by specifying its DAG ID and run ID to manage workflow progress.

Instructions

Update a DAG run state by DAG ID and DAG run ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dag_idYes
dag_run_idYes
stateNo

Implementation Reference

  • The core handler function implementing the 'update_dag_run_state' tool. It updates the state of a specific DAG run using the Airflow API client.
    async def update_dag_run_state(
        dag_id: str, dag_run_id: str, state: Optional[str] = None
    ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]:
        update_dag_run_state = UpdateDagRunState(state=state)
        response = dag_run_api.update_dag_run_state(
            dag_id=dag_id,
            dag_run_id=dag_run_id,
            update_dag_run_state=update_dag_run_state,
        )
        return [types.TextContent(type="text", text=str(response.to_dict()))]
  • The list returned by get_all_functions() in dagrun.py, which includes the registration details (function reference, name, description, read-only flag) for the 'update_dag_run_state' tool. This list is imported and used in src/main.py to register the tool with the MCP server.
    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),
    ]
  • Import of the UpdateDagRunState model, which defines the structure for the request body used in the tool's handler to validate and send the new state to the Airflow API.
    from airflow_client.client.model.update_dag_run_state import UpdateDagRunState
  • src/main.py:95-96 (registration)
    The generic MCP tool registration code in main.py that adds all tools from DAGRUN module (including update_dag_run_state) to the FastMCP app using Tool.from_function, inferring schema from function signature.
    for func, name, description, *_ in functions:
        app.add_tool(Tool.from_function(func, name=name, description=description))
Behavior1/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It doesn't disclose whether this is a destructive mutation, what permissions are required, how state changes affect workflows, or what happens if the DAG run doesn't exist. For a state-update tool with zero annotation coverage, this is inadequate.

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

Conciseness5/5

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

The description is a single, efficient sentence with zero wasted words. It's front-loaded with the core action and identifiers, making it easy to parse quickly. Every word contributes directly to the tool's purpose.

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

Completeness2/5

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

Given the tool's complexity (state mutation), lack of annotations, 0% schema coverage, and no output schema, the description is insufficient. It doesn't cover behavioral risks, parameter details, return values, or error conditions. For a mutation tool in a workflow system, more context is needed to use it safely and effectively.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate but only partially does. It mentions 'DAG ID' and 'DAG run ID' as identifiers, mapping to two required parameters, but doesn't explain the 'state' parameter's purpose, possible values (e.g., 'running', 'failed'), or that it's optional with a default of null. This leaves key parameter meaning undocumented.

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

Purpose4/5

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

The description clearly states the action ('Update') and target ('DAG run state') with specific identifiers ('by DAG ID and DAG run ID'). It distinguishes this from siblings like 'delete_dag_run' or 'set_task_instances_state' by focusing on state modification rather than deletion or task-level changes. However, it doesn't fully differentiate from 'set_dag_run_note' which might also involve DAG run updates.

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 'set_task_instances_state' or 'clear_dag_run'. It mentions no prerequisites, constraints, or typical scenarios for updating DAG run states, leaving the agent to infer usage from the tool name alone.

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/yangkyeongmo/mcp-server-apache-airflow'

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