Skip to main content
Glama
yangkyeongmo

MCP Server for Apache Airflow

by yangkyeongmo

set_task_instances_state

Change the state of Airflow task instances to manage workflow execution, such as marking tasks as failed or successful for troubleshooting or manual intervention.

Instructions

Set a state of task instances

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dag_idYes
stateYes
task_idsNo
execution_dateNo
include_upstreamNo
include_downstreamNo
include_futureNo
include_pastNo
dry_runNo

Implementation Reference

  • The main asynchronous handler function for the 'set_task_instances_state' tool. It constructs an UpdateTaskInstancesState object from the input parameters and calls the Airflow DAG API to set the state of the specified task instances.
    async def set_task_instances_state(
        dag_id: str,
        state: str,
        task_ids: Optional[List[str]] = None,
        execution_date: Optional[str] = None,
        include_upstream: Optional[bool] = None,
        include_downstream: Optional[bool] = None,
        include_future: Optional[bool] = None,
        include_past: Optional[bool] = None,
        dry_run: Optional[bool] = None,
    ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]:
        state_request = {"state": state}
        if task_ids is not None:
            state_request["task_ids"] = task_ids
        if execution_date is not None:
            state_request["execution_date"] = execution_date
        if include_upstream is not None:
            state_request["include_upstream"] = include_upstream
        if include_downstream is not None:
            state_request["include_downstream"] = include_downstream
        if include_future is not None:
            state_request["include_future"] = include_future
        if include_past is not None:
            state_request["include_past"] = include_past
        if dry_run is not None:
            state_request["dry_run"] = dry_run
    
        update_task_instances_state = UpdateTaskInstancesState(**state_request)
    
        response = dag_api.post_set_task_instances_state(
            dag_id=dag_id,
            update_task_instances_state=update_task_instances_state,
        )
        return [types.TextContent(type="text", text=str(response.to_dict()))]
  • The registration of all tools, including 'set_task_instances_state' as a tuple (function, name, description, is_read_only=False). This list is returned by get_all_functions() 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 [
            (get_dags, "fetch_dags", "Fetch all DAGs", True),
            (get_dag, "get_dag", "Get a DAG by ID", True),
            (get_dag_details, "get_dag_details", "Get a simplified representation of DAG", True),
            (get_dag_source, "get_dag_source", "Get a source code", True),
            (pause_dag, "pause_dag", "Pause a DAG by ID", False),
            (unpause_dag, "unpause_dag", "Unpause a DAG by ID", False),
            (get_dag_tasks, "get_dag_tasks", "Get tasks for DAG", True),
            (get_task, "get_task", "Get a task by ID", True),
            (get_tasks, "get_tasks", "Get tasks for DAG", True),
            (patch_dag, "patch_dag", "Update a DAG", False),
            (patch_dags, "patch_dags", "Update multiple DAGs", False),
            (delete_dag, "delete_dag", "Delete a DAG", False),
            (clear_task_instances, "clear_task_instances", "Clear a set of task instances", False),
            (set_task_instances_state, "set_task_instances_state", "Set a state of task instances", False),
            (reparse_dag_file, "reparse_dag_file", "Request re-parsing of a DAG file", False),
        ]
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 provides none. 'Set a state' implies a mutation operation, but there's no information about permissions required, whether changes are destructive or reversible, rate limits, side effects, or what happens when state is changed. For a tool with 9 parameters that appears to modify workflow execution states, this lack of behavioral context is critically inadequate.

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

Conciseness4/5

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

The description is extremely concise at just 5 words, which is appropriate for its length. However, this conciseness comes at the cost of being severely under-specified rather than efficiently informative. The single sentence is front-loaded with the core action but lacks any supporting context that would make it genuinely helpful.

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 (9 parameters, no output schema, no annotations, and multiple similar sibling tools), this description is completely inadequate. It fails to explain what the tool does beyond the obvious, provides no parameter guidance, offers no behavioral context, and gives no usage differentiation. For a state-modification tool in what appears to be a workflow/airflow system, this minimal description leaves the agent guessing about critical operational details.

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?

With 0% schema description coverage and 9 parameters (7 optional), the description provides zero information about any parameters. It doesn't mention dag_id, state, task_ids, execution_date, or any of the boolean flags (include_upstream, include_downstream, etc.). The agent must rely entirely on parameter names without any semantic explanation of what these parameters mean or how they interact.

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 'Set a state of task instances' is essentially a tautology that restates the tool name with minor grammatical changes. While it indicates the verb ('set') and resource ('task instances'), it lacks specificity about what 'state' means or how this differs from similar tools like 'update_task_instance' or 'clear_task_instances' in the sibling list. The purpose is vague and doesn't provide meaningful differentiation.

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?

The description provides absolutely no guidance on when to use this tool versus alternatives. With multiple sibling tools that manipulate task instances (clear_task_instances, update_task_instance, list_task_instances), the agent receives no indication of when this specific state-setting operation is appropriate versus other modification operations. There's no mention of prerequisites, typical use cases, or exclusions.

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