Skip to main content
Glama
astronomer

astro-airflow-mcp

Official
by astronomer

get_task

Retrieve detailed task definition from an Airflow DAG: operator type, upstream/downstream dependencies, retries, execution timeout, trigger rule, and more. Use to inspect task configuration and relationships.

Instructions

Get detailed information about a specific task definition in a DAG.

Use this tool when the user asks about:

  • "Show me details for task X in DAG Y" or "What does task Z do?"

  • "What operator does task A use?" or "What's the configuration of task B?"

  • "Tell me about task C" or "Get task definition for D"

  • "What are the dependencies of task E?" or "Which tasks does F depend on?"

Returns task definition information including:

  • task_id: Unique identifier for the task

  • task_display_name: Human-readable display name

  • owner: Who owns this task

  • start_date: When this task becomes active

  • end_date: When this task becomes inactive (if set)

  • trigger_rule: When this task should run (all_success, one_failed, etc.)

  • depends_on_past: Whether task depends on previous run's success

  • wait_for_downstream: Whether to wait for downstream tasks

  • retries: Number of retry attempts

  • retry_delay: Time between retries

  • execution_timeout: Maximum execution time

  • operator_name: Type of operator (PythonOperator, BashOperator, etc.)

  • pool: Resource pool assignment

  • queue: Queue for executor

  • downstream_task_ids: List of tasks that depend on this task

  • upstream_task_ids: List of tasks this task depends on

Args: dag_id: The ID of the DAG containing the task task_id: The ID of the task to get details for

Returns: JSON with complete task definition details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dag_idYes
task_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool registration and public interface for 'get_task' using the @mcp.tool() decorator. Delegates to _get_task_impl.
    @mcp.tool()
    def get_task(dag_id: str, task_id: str) -> str:
        """Get detailed information about a specific task definition in a DAG.
    
        Use this tool when the user asks about:
        - "Show me details for task X in DAG Y" or "What does task Z do?"
        - "What operator does task A use?" or "What's the configuration of task B?"
        - "Tell me about task C" or "Get task definition for D"
        - "What are the dependencies of task E?" or "Which tasks does F depend on?"
    
        Returns task definition information including:
        - task_id: Unique identifier for the task
        - task_display_name: Human-readable display name
        - owner: Who owns this task
        - start_date: When this task becomes active
        - end_date: When this task becomes inactive (if set)
        - trigger_rule: When this task should run (all_success, one_failed, etc.)
        - depends_on_past: Whether task depends on previous run's success
        - wait_for_downstream: Whether to wait for downstream tasks
        - retries: Number of retry attempts
        - retry_delay: Time between retries
        - execution_timeout: Maximum execution time
        - operator_name: Type of operator (PythonOperator, BashOperator, etc.)
        - pool: Resource pool assignment
        - queue: Queue for executor
        - downstream_task_ids: List of tasks that depend on this task
        - upstream_task_ids: List of tasks this task depends on
    
        Args:
            dag_id: The ID of the DAG containing the task
            task_id: The ID of the task to get details for
    
        Returns:
            JSON with complete task definition details
        """
        return _get_task_impl(dag_id=dag_id, task_id=task_id)
  • The handler function that executes the get_task logic. Gets the appropriate versioned adapter and calls adapter.get_task(dag_id, task_id), then serializes the result as JSON.
    def _get_task_impl(dag_id: str, task_id: str) -> str:
        """Internal implementation for getting task details from Airflow.
    
        Args:
            dag_id: The ID of the DAG
            task_id: The ID of the task
    
        Returns:
            JSON string containing the task details
        """
        try:
            adapter = _get_adapter()
            data = adapter.get_task(dag_id, task_id)
            return json.dumps(data, indent=2)
        except Exception as e:
            return str(e)
  • Abstract method definition in the base adapter interface, defining the contract: takes dag_id and task_id strings, returns a dict.
    @abstractmethod
    def get_task(self, dag_id: str, task_id: str) -> dict[str, Any]:
        """Get details of a specific task."""
  • Airflow 2.x implementation: calls GET /api/v1/dags/{dag_id}/tasks/{task_id}
    def get_task(self, dag_id: str, task_id: str) -> dict[str, Any]:
        """Get details of a specific task."""
        return self._call(f"dags/{dag_id}/tasks/{task_id}")
  • Airflow 3.x implementation: calls GET /api/v2/dags/{dag_id}/tasks/{task_id}
    def get_task(self, dag_id: str, task_id: str) -> dict[str, Any]:
        """Get details of a specific task."""
        return self._call(f"dags/{dag_id}/tasks/{task_id}")
Behavior4/5

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

No annotations exist, so description carries full burden. It comprehensively lists all return fields (18 attributes) but does not mention error handling or permissions. Still, it transparently describes the tool's read-only behavior and output.

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?

Description is well-structured with a clear purpose statement, usage examples, and a formatted list of return fields. Slightly lengthy but every section adds value; no unnecessary content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (2 params) and absent output schema, the description fully compensates by detailing all return fields. It covers the essential information needed for an agent to invoke and interpret results correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so description must compensate. It provides brief explanations for dag_id and task_id ('The ID of the DAG containing the task', 'The ID of the task to get details for') but no additional details like formats, constraints, or examples. This is minimally adequate but not enriching.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves detailed information about a specific task definition in a DAG. It distinguishes itself from siblings like get_task_instance and get_task_logs by focusing on task definitions, aiding correct selection.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit when-to-use guidance with example user queries. Lacks explicit when-not-to-use or alternative sibling names, but the examples sufficiently imply its scope.

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/astronomer/astro-airflow-mcp'

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