get_task_instance_logs
Retrieve execution logs for a specific Airflow task instance to monitor performance, debug failures, and analyze task behavior during DAG runs.
Instructions
[Tool Role]: Retrieves logs for a specific task instance.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dag_id | Yes | ||
| dag_run_id | Yes | ||
| task_id | Yes | ||
| try_number | No |
Implementation Reference
- The core handler function implementing the get_task_instance_logs tool. It makes an API request to retrieve logs for a specific task instance try_number from the Airflow API. The @mcp.tool() decorator handles registration.async def get_task_instance_logs(dag_id: str, dag_run_id: str, task_id: str, try_number: int = 1) -> Dict[str, Any]: """[Tool Role]: Retrieves logs for a specific task instance.""" resp = await airflow_request("GET", f"/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/logs/{try_number}") resp.raise_for_status() return resp.json()