Skip to main content
Glama

get_task_logs

Retrieve execution logs for specific Apache Airflow tasks in MWAA environments to monitor workflow performance and troubleshoot issues.

Instructions

Get logs for a specific task instance.

Args: environment_name: Name of the MWAA environment dag_id: The DAG ID dag_run_id: The DAG run ID task_id: The task ID task_try_number: Specific try number (optional)

Returns: Dictionary containing task logs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
environment_nameYes
dag_idYes
dag_run_idYes
task_idYes
task_try_numberNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The actual implementation of the get_task_logs logic, which constructs the Airflow API endpoint and calls the API.
    async def get_task_logs(
        self,
        environment_name: str,
        dag_id: str,
        dag_run_id: str,
        task_id: str,
        task_try_number: Optional[int] = None,
    ) -> Dict[str, Any]:
        """Get task logs via Airflow API."""
        if task_try_number is None:
            task_try_number = 1
    
        endpoint = (
            f"/dags/{dag_id}/dagRuns/{dag_run_id}"
            f"/taskInstances/{task_id}/logs/{task_try_number}"
        )
        return self._invoke_airflow_api(environment_name, "GET", endpoint)
  • The MCP tool registration and wrapper function that handles input processing before calling the tools implementation.
    @mcp.tool(name="get_task_logs")
    async def get_task_logs(
        environment_name: str,
        dag_id: str,
        dag_run_id: str,
        task_id: str,
        task_try_number: Optional[int] = None,
    ) -> Dict[str, Any]:
        """Get logs for a specific task instance.
    
        Args:
            environment_name: Name of the MWAA environment
            dag_id: The DAG ID
            dag_run_id: The DAG run ID
            task_id: The task ID
            task_try_number: Specific try number (optional)
    
        Returns:
            Dictionary containing task logs
        """
        task_try_number_int = int(task_try_number) if task_try_number is not None else None
    
        return await tools.get_task_logs(
            environment_name, dag_id, dag_run_id, task_id, task_try_number_int
        )
Behavior2/5

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

No annotations are provided, so the description carries the full burden. While 'Get' implies read-only behavior, the description does not confirm idempotency, disclose log retention limits, truncation behavior, or whether multiple calls are needed for streaming logs.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Follows docstring structure with front-loaded purpose, but contains inefficient repetition in Args ('The X ID' patterns). The Returns section is appropriately terse given the existence of an output schema.

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

Completeness3/5

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

Adequate for a log retrieval tool with 5 parameters, though it misses Airflow-specific context (e.g., DAG execution flow) and log availability constraints. The output schema absolves the description from detailing return values.

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?

With 0% schema description coverage, the description compensates via an Args block. 'environment_name' notes the MWAA context, but 'dag_id', 'dag_run_id', and 'task_id' are documented tautologically ('The DAG ID'). 'task_try_number' notes optionality, providing minimal value beyond the schema's null default.

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?

Clear verb 'Get' with resource 'logs' and scope 'specific task instance'. However, it does not explicitly distinguish from the sibling tool 'get_task_instance' (which likely retrieves metadata/status rather than logs), though the mention of 'logs' does imply a distinct purpose.

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 provided on when to use this tool versus alternatives like 'get_task_instance', nor does it mention prerequisites (e.g., task must be started/running to have logs).

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/paschmaria/mwaa-mcp-server'

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