Skip to main content
Glama
nikhil-ganage

MCP Server Airflow Token

update_task_instance

Modify task instance state in Apache Airflow workflows using DAG ID, DAG run ID, and task ID parameters to manage workflow execution.

Instructions

Update a task instance by DAG ID, DAG run ID, and task ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dag_idYes
dag_run_idYes
task_idYes
stateNo

Implementation Reference

  • The async handler function that implements the core logic of the 'update_task_instance' tool by calling the Airflow TaskInstanceApi to patch the task instance state.
    async def update_task_instance(
        dag_id: str, dag_run_id: str, task_id: str, state: Optional[str] = None
    ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]:
        update_request = {}
        if state is not None:
            update_request["state"] = state
    
        response = task_instance_api.patch_task_instance(
            dag_id=dag_id,
            dag_run_id=dag_run_id,
            task_id=task_id,
            update_mask=list(update_request.keys()),
            task_instance_request=update_request,
        )
        return [types.TextContent(type="text", text=str(response.to_dict()))]
  • Module-level function that returns the registration details for task instance tools, including the 'update_task_instance' tool.
    def get_all_functions() -> list[tuple[Callable, str, str, bool]]:
        """Return list of (function, name, description, is_read_only) tuples for registration."""
        return [
            (get_task_instance, "get_task_instance", "Get a task instance by DAG ID, task ID, and DAG run ID", True),
            (list_task_instances, "list_task_instances", "List task instances by DAG ID and DAG run ID", True),
            (
                update_task_instance,
                "update_task_instance",
                "Update a task instance by DAG ID, DAG run ID, and task ID",
                False,
            ),
        ]
  • src/main.py:17-35 (registration)
    Top-level import and mapping of the taskinstance module's get_all_functions for global tool registration in the MCP server.
    from src.airflow.taskinstance import get_all_functions as get_taskinstance_functions
    from src.airflow.variable import get_all_functions as get_variable_functions
    from src.airflow.xcom import get_all_functions as get_xcom_functions
    from src.enums import APIType
    
    APITYPE_TO_FUNCTIONS = {
        APIType.CONFIG: get_config_functions,
        APIType.CONNECTION: get_connection_functions,
        APIType.DAG: get_dag_functions,
        APIType.DAGRUN: get_dagrun_functions,
        APIType.DAGSTATS: get_dagstats_functions,
        APIType.DATASET: get_dataset_functions,
        APIType.EVENTLOG: get_eventlog_functions,
        APIType.IMPORTERROR: get_importerror_functions,
        APIType.MONITORING: get_monitoring_functions,
        APIType.PLUGIN: get_plugin_functions,
        APIType.POOL: get_pool_functions,
        APIType.PROVIDER: get_provider_functions,
        APIType.TASKINSTANCE: get_taskinstance_functions,
  • src/main.py:90-92 (registration)
    The loop that registers all tools from modules like taskinstance by calling app.add_tool with the function, name, and description.
    for func, name, description, *_ in functions:
        app.add_tool(func, name=name, description=description)
Behavior2/5

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

With no annotations provided, the description carries full burden but only mentions the update action without disclosing behavioral traits like required permissions, whether changes are reversible, rate limits, or what the response looks like. It lacks critical details for a mutation tool, though it doesn't contradict any annotations.

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 a single, efficient sentence that front-loads the core action. It wastes no words but could be more structured by including key details like parameter meanings or usage context, though it's appropriately sized for its limited content.

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 (4 parameters, no annotations, no output schema), the description is incomplete. It lacks information on behavioral aspects, parameter meanings, and expected outcomes, making it inadequate for safe and effective use by an AI agent in this context.

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 lists the three required parameters (dag_id, dag_run_id, task_id) without explaining their semantics or the optional 'state' parameter. It adds minimal value beyond the schema's property names, failing to clarify usage or constraints.

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 resource ('a task instance'), specifying it's done by three identifiers (DAG ID, DAG run ID, task ID). It's specific but doesn't differentiate from sibling tools like 'set_task_instances_state' or 'update_dag_run_state', which might have overlapping purposes.

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?

No guidance is provided on when to use this tool versus alternatives such as 'set_task_instances_state' or 'clear_task_instances'. The description only states what it does without context, prerequisites, or exclusions, leaving the agent to guess based on tool names 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/nikhil-ganage/mcp-server-airflow-token'

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