list_xcom_entries
Retrieve cross-communication data between Airflow tasks to monitor task outputs and dependencies for specific DAG runs.
Instructions
[Tool Role]: Lists XCom entries for a specific task instance.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dag_id | Yes | ||
| dag_run_id | Yes | ||
| task_id | Yes | ||
| limit | No | ||
| offset | No |
Implementation Reference
- The main handler function implementing the 'list_xcom_entries' tool. It queries the Airflow REST API to retrieve XCom entries for a given DAG run and task instance with pagination support.@mcp.tool() async def list_xcom_entries(dag_id: str, dag_run_id: str, task_id: str, limit: int = 20, offset: int = 0) -> Dict[str, Any]: """[Tool Role]: Lists XCom entries for a specific task instance.""" params = {'limit': limit, 'offset': offset} query_string = "&".join([f"{k}={v}" for k, v in params.items()]) resp = await airflow_request("GET", f"/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/xcomEntries?{query_string}") resp.raise_for_status() return resp.json()
- src/mcp_airflow_api/tools/v1_tools.py:13-27 (registration)Registration function for Airflow API v1 that sets the v1-specific airflow_request and calls register_common_tools(mcp), which defines and registers the list_xcom_entries tool among others.def register_tools(mcp): """Register v1 tools by importing common tools with v1 request function.""" logger.info("Initializing MCP server for Airflow API v1") logger.info("Loading Airflow API v1 tools (Airflow 2.x)") # Set the global request function to v1 common_tools.airflow_request = airflow_request_v1 # Register all 56 common tools (includes management tools) common_tools.register_common_tools(mcp) # V1 has no exclusive tools - all tools are shared with v2 logger.info("Registered all Airflow API v1 tools (56 tools: 43 core + 13 management tools)")
- src/mcp_airflow_api/tools/v2_tools.py:14-25 (registration)Registration function for Airflow API v2 that sets the v2-specific airflow_request and calls register_common_tools(mcp), which defines and registers the list_xcom_entries tool among others.def register_tools(mcp): """Register v2 tools: common tools + v2-exclusive asset tools.""" logger.info("Initializing MCP server for Airflow API v2") logger.info("Loading Airflow API v2 tools (Airflow 3.0+)") # Set the global request function to v2 common_tools.airflow_request = airflow_request_v2 # Register all 43 common tools common_tools.register_common_tools(mcp)
- src/mcp_airflow_api/mcp_main.py:263-267 (registration)Top-level registration call for v1 tools in mcp_main.py, which indirectly registers the list_xcom_entries tool via v1_tools.register_tools.if api_version == "v1": logger.info("Loading Airflow API v1 tools (Airflow 2.x)") from mcp_airflow_api.tools import v1_tools v1_tools.register_tools(mcp_instance) elif api_version == "v2":
- src/mcp_airflow_api/mcp_main.py:267-270 (registration)Top-level registration call for v2 tools in mcp_main.py, which indirectly registers the list_xcom_entries tool via v2_tools.register_tools.elif api_version == "v2": logger.info("Loading Airflow API v2 tools (Airflow 3.0+)") from mcp_airflow_api.tools import v2_tools v2_tools.register_tools(mcp_instance)