Skip to main content
Glama
yangkyeongmo

MCP Server for Apache Airflow

by yangkyeongmo

get_task_instance

Retrieve specific task instance details from Apache Airflow workflows using DAG ID, task ID, and DAG run ID parameters for monitoring and debugging.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dag_idYes
task_idYes
dag_run_idYes

Implementation Reference

  • The main handler function for the 'get_task_instance' tool. It calls the Airflow TaskInstanceApi to fetch the task instance and returns it as TextContent.
    async def get_task_instance( dag_id: str, task_id: str, dag_run_id: str ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]: response = task_instance_api.get_task_instance(dag_id=dag_id, dag_run_id=dag_run_id, task_id=task_id) return [types.TextContent(type="text", text=str(response.to_dict()))]
  • The registration tuple for the 'get_task_instance' tool within the get_all_functions() list, which is imported and used in main.py to register tools with MCP.
    (get_task_instance, "get_task_instance", "Get a task instance by DAG ID, task ID, and DAG run ID", True),
  • Initialization of the TaskInstanceApi client used by the get_task_instance handler.
    task_instance_api = TaskInstanceApi(api_client)
  • src/main.py:18-18 (registration)
    Import of get_all_functions from taskinstance module in main.py, which leads to registration of the tool.
    from src.airflow.taskinstance import get_all_functions as get_taskinstance_functions
  • src/main.py:96-96 (registration)
    The generic tool registration loop in main.py where tools from get_all_functions (including get_task_instance) are added to the MCP app.
    app.add_tool(Tool.from_function(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/yangkyeongmo/mcp-server-apache-airflow'

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