Skip to main content
Glama
yangkyeongmo

MCP Server for Apache Airflow

by yangkyeongmo

post_dag_run

Trigger a DAG by ID in Apache Airflow to start workflow execution with optional parameters like run ID, data intervals, and execution date.

Instructions

Trigger a DAG by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dag_idYes
dag_run_idNo
data_interval_endNo
data_interval_startNo
execution_dateNo
logical_dateNo
noteNo

Implementation Reference

  • The main handler function for the 'post_dag_run' tool. It constructs a DAGRun object from provided parameters and triggers the DAG run using the Airflow DAGRunApi.
    async def post_dag_run(
        dag_id: str,
        dag_run_id: Optional[str] = None,
        data_interval_end: Optional[datetime] = None,
        data_interval_start: Optional[datetime] = None,
        execution_date: Optional[datetime] = None,
        logical_date: Optional[datetime] = None,
        note: Optional[str] = None,
        # state: Optional[str] = None,  # TODO: add state
    ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]:
        # Build kwargs dictionary with only non-None values
        kwargs = {}
    
        # Add non-read-only fields that can be set during creation
        if dag_run_id is not None:
            kwargs["dag_run_id"] = dag_run_id
        if data_interval_end is not None:
            kwargs["data_interval_end"] = data_interval_end
        if data_interval_start is not None:
            kwargs["data_interval_start"] = data_interval_start
        if execution_date is not None:
            kwargs["execution_date"] = execution_date
        if logical_date is not None:
            kwargs["logical_date"] = logical_date
        if note is not None:
            kwargs["note"] = note
    
        # Create DAGRun without read-only fields
        dag_run = DAGRun(**kwargs)
    
        response = dag_run_api.post_dag_run(dag_id=dag_id, dag_run=dag_run)
        return [types.TextContent(type="text", text=str(response.to_dict()))]
  • Registration of the 'post_dag_run' tool within the list of functions returned by get_all_functions(), 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),
        ]
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Trigger a DAG' implies a write/mutation operation, but it doesn't specify whether this creates a new DAG run, what happens if a run already exists, whether it's idempotent, or what the response looks like. For a mutation tool with zero annotation coverage, this is a significant gap in safety and operational context.

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 at just 4 words, with zero wasted language. It's front-loaded with the core action and resource. While it's under-specified for a tool with 7 parameters, it's not verbose or poorly structured—it just lacks necessary detail.

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 complexity (7 parameters, mutation operation, no output schema, 0% schema description coverage, no annotations), the description is incomplete. It doesn't explain what the tool returns, how parameters interact, error conditions, or behavioral nuances. For a tool that likely initiates workflow executions, this leaves critical gaps for an AI agent to use it correctly.

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%, meaning none of the 7 parameters have descriptions in the schema. The tool description adds no parameter information beyond the name 'dag_id' implied by 'by ID'. It doesn't explain what 'dag_run_id', 'data_interval_start/end', 'execution_date', 'logical_date', or 'note' are for, leaving most parameters undocumented. The description fails to compensate for the schema gap.

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

Purpose3/5

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

The description 'Trigger a DAG by ID' clearly states the action (trigger) and target resource (DAG), which is better than a tautology. However, it lacks specificity about what 'trigger' means in this context (e.g., starting a workflow execution) and doesn't distinguish it from sibling tools like 'update_dag_run_state' or 'pause_dag/unpause_dag' that also affect DAG runs. The purpose is understandable but vague.

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. It doesn't mention prerequisites (e.g., DAG must exist, be unpaused), when to use it over other DAG-related tools like 'update_dag_run_state', or any constraints (e.g., rate limits, permissions). With many sibling tools affecting DAGs, this omission leaves the agent without context for tool selection.

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