Skip to main content
Glama
yangkyeongmo

MCP Server for Apache Airflow

by yangkyeongmo

get_task_instance

Retrieve a specific task instance in Apache Airflow by providing the DAG ID, task ID, and DAG run ID. Simplifies task monitoring and management within workflows.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dag_idYes
dag_run_idYes
task_idYes

Implementation Reference

  • The async handler function that implements the core logic of the 'get_task_instance' tool by calling the Airflow TaskInstanceApi and returning the response as formatted 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 module's get_all_functions() list, providing the function reference, name, description, and read-only flag.
    (get_task_instance, "get_task_instance", "Get a task instance by DAG ID, task ID, and DAG run ID", True),
  • src/main.py:18-18 (registration)
    Import of the taskinstance module's get_all_functions into the main.py for inclusion in the central tool registration process.
    from src.airflow.taskinstance import get_all_functions as get_taskinstance_functions
  • src/main.py:37-37 (registration)
    Mapping of APIType.TASKINSTANCE to the taskinstance functions getter in the central APITYPE_TO_FUNCTIONS dictionary.
    APIType.TASKINSTANCE: get_taskinstance_functions,
  • src/main.py:95-96 (registration)
    The generic loop in main() that adds each tool (including get_task_instance) to the MCP app using Tool.from_function.
    for func, name, description, *_ in functions: 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