get_xcom_entry
Retrieve a specific cross-communication (XCom) entry for a task instance in an Apache Airflow DAG by providing the DAG ID, run ID, task ID, and XCom key. Retrieves both the value and metadata.
Instructions
[Tool Role]: Retrieves a specific XCom entry for a task instance.
Args:
dag_id: The DAG ID
dag_run_id: The DAG run ID
task_id: The task ID
xcom_key: The XCom key to retrieve
map_index: Map index for mapped tasks (default: -1 for non-mapped)
Returns: Dictionary containing the specific XCom entry with full value and metadata
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dag_id | Yes | ||
| dag_run_id | Yes | ||
| map_index | No | ||
| task_id | Yes | ||
| xcom_key | Yes |
Implementation Reference
- The handler function for the 'get_xcom_entry' tool. It makes a GET request to the Airflow API to retrieve a specific XCom entry given dag_id, dag_run_id, task_id, and xcom_key. The function is registered as an MCP tool using the @mcp.tool() decorator.@mcp.tool() async def get_xcom_entry(dag_id: str, dag_run_id: str, task_id: str, xcom_key: str) -> Dict[str, Any]: """[Tool Role]: Gets a specific XCom entry.""" resp = await airflow_request("GET", f"/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/xcomEntries/{xcom_key}") resp.raise_for_status() return resp.json()
- src/mcp_airflow_api/tools/common_tools.py:826-826 (registration)The @mcp.tool() decorator registers the get_xcom_entry function as an MCP tool within the register_common_tools function.@mcp.tool()