Skip to main content
Glama
nikhil-ganage

MCP Server Airflow Token

clear_dag_run

Clear a specific DAG run in Apache Airflow to remove task instances and reset execution status for troubleshooting or restarting workflows.

Instructions

Clear a DAG run

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dag_idYes
dag_run_idYes
dry_runNo

Implementation Reference

  • The handler function that executes the clear_dag_run tool logic by calling the Airflow DAGRunApi.clear_dag_run endpoint with the provided parameters.
    async def clear_dag_run(
        dag_id: str, dag_run_id: str, dry_run: Optional[bool] = None
    ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]:
        clear_dag_run = ClearDagRun(dry_run=dry_run)
        response = dag_run_api.clear_dag_run(dag_id=dag_id, dag_run_id=dag_run_id, clear_dag_run=clear_dag_run)
        return [types.TextContent(type="text", text=str(response.to_dict()))]
  • Registers the clear_dag_run tool (along with other DAG run tools) by returning a tuple (function, name, description, read_only) that is later used in app.add_tool().
    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),
        ]
  • Imports the ClearDagRun Pydantic model used for input validation and serialization in the clear_dag_run handler.
    from airflow_client.client.model.clear_dag_run import ClearDagRun
Behavior1/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure but fails to do so. It does not explain what 'clear' entails (e.g., destructive effects, permissions required, or side effects), nor does it mention the 'dry_run' parameter's purpose or any operational constraints like rate limits.

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 extremely concise with a single sentence, 'Clear a DAG run', which is front-loaded and wastes no words. However, this conciseness comes at the cost of under-specification, but per scoring rules, it earns a high score for brevity.

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

Completeness1/5

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

Given the complexity of a tool with 3 parameters (2 required), no annotations, no output schema, and 0% schema coverage, the description is completely inadequate. It fails to provide necessary context for safe and effective use, such as behavioral traits, parameter meanings, or expected outcomes.

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

Parameters1/5

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

Schema description coverage is 0%, and the description adds no information about parameters. It does not explain the meaning of 'dag_id', 'dag_run_id', or the optional 'dry_run' parameter, leaving all three parameters undocumented and their semantics unclear.

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

Purpose2/5

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

The description 'Clear a DAG run' restates the tool name with minimal elaboration, making it a tautology. It lacks specificity about what 'clear' means (e.g., deleting, resetting, or removing data) and does not differentiate from sibling tools like 'delete_dag_run' or 'clear_task_instances', leaving the purpose vague.

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

Usage Guidelines1/5

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

No guidance is provided on when to use this tool versus alternatives. It does not mention prerequisites, context, or exclusions, nor does it reference sibling tools like 'delete_dag_run' or 'clear_task_instances' for comparison, making it misleading for an agent to select appropriately.

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

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