get_xcom_entry
Retrieve specific XCom data from Apache Airflow using parameters like DAG ID, task ID, and XCom key, enabling precise extraction of cross-communication data between tasks.
Instructions
Get an XCom entry
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dag_id | Yes | ||
| dag_run_id | Yes | ||
| deserialize | No | ||
| map_index | No | ||
| stringify | No | ||
| task_id | Yes | ||
| xcom_key | Yes |
Implementation Reference
- src/airflow/xcom.py:43-64 (handler)The handler function that executes the "get_xcom_entry" tool. It constructs parameters and calls the Airflow XComApi to fetch the specific XCom entry, returning it as a text content response.async def get_xcom_entry( dag_id: str, dag_run_id: str, task_id: str, xcom_key: str, map_index: Optional[int] = None, deserialize: Optional[bool] = None, stringify: Optional[bool] = None, ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]: # Build parameters dictionary kwargs: Dict[str, Any] = {} if map_index is not None: kwargs["map_index"] = map_index if deserialize is not None: kwargs["deserialize"] = deserialize if stringify is not None: kwargs["stringify"] = stringify response = xcom_api.get_xcom_entry( dag_id=dag_id, dag_run_id=dag_run_id, task_id=task_id, xcom_key=xcom_key, **kwargs ) return [types.TextContent(type="text", text=str(response.to_dict()))]
- src/airflow/xcom.py:11-16 (registration)The module registration function listing available tools, including "get_xcom_entry". This is imported and called in src/main.py to register the tool with the MCP server.def get_all_functions() -> list[tuple[Callable, str, str, bool]]: """Return list of (function, name, description, is_read_only) tuples for registration.""" return [ (get_xcom_entries, "get_xcom_entries", "Get all XCom entries", True), (get_xcom_entry, "get_xcom_entry", "Get an XCom entry", True), ]