Skip to main content
Glama

MCP Server Airflow Token

update_task_instance

Modify the state of a specific task instance within an Airflow DAG run by providing the DAG ID, DAG run ID, and task ID.

Instructions

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

Input Schema

NameRequiredDescriptionDefault
dag_idYes
dag_run_idYes
stateNo
task_idYes

Input Schema (JSON Schema)

{ "properties": { "dag_id": { "title": "Dag Id", "type": "string" }, "dag_run_id": { "title": "Dag Run Id", "type": "string" }, "state": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "State" }, "task_id": { "title": "Task Id", "type": "string" } }, "required": [ "dag_id", "dag_run_id", "task_id" ], "type": "object" }

Implementation Reference

  • The async handler function that executes the tool logic, updating the task instance state using Airflow's TaskInstanceApi.
    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()))]
  • Registers the update_task_instance tool in the module's get_all_functions() list, providing the handler, name, description, and mutability flag.
    ( update_task_instance, "update_task_instance", "Update a task instance by DAG ID, DAG run ID, and task ID", False, ),
  • src/main.py:17-17 (registration)
    Imports the get_all_functions from taskinstance module for inclusion in MCP tool registration.
    from src.airflow.taskinstance import get_all_functions as get_taskinstance_functions
  • src/main.py:35-35 (registration)
    Maps APIType.TASKINSTANCE to the taskinstance functions getter in the central APITYPE_TO_FUNCTIONS dictionary used for tool registration.
    APIType.TASKINSTANCE: get_taskinstance_functions,
  • src/main.py:90-91 (registration)
    Loop that adds each tool from the functions list (including update_task_instance) to the MCP app using app.add_tool.
    for func, name, description, *_ in functions: app.add_tool(func, name=name, description=description)

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