list_datasets
Retrieve all datasets from Airflow v1 API to monitor data dependencies and pipeline connections in your workflow system.
Instructions
[Tool Role]: Lists all datasets in the Airflow system (v1 API only - v2 uses Assets).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| offset | No | ||
| uri_pattern | No |
Implementation Reference
- The main handler function for the 'list_datasets' tool. It is decorated with @mcp.tool() which handles registration. The function lists datasets via Airflow API v1, with support for pagination and URI filtering, and provides v2 compatibility note.@mcp.tool() async def list_datasets(limit: int = 20, offset: int = 0, uri_pattern: Optional[str] = None) -> Dict[str, Any]: """[Tool Role]: Lists all datasets in the Airflow system (v1 API only - v2 uses Assets).""" from ..functions import get_api_version api_version = get_api_version() if api_version == "v2": return { "error": "Dataset API is not available in Airflow 3.x (API v2)", "available_in": "v1 only", "v2_alternative": "Use list_assets() for Airflow 3.x data-aware scheduling" } params = [] params.append(f"limit={limit}") if offset > 0: params.append(f"offset={offset}") if uri_pattern: params.append(f"uri_pattern={uri_pattern}") query_string = "&".join(params) if params else "" endpoint = f"/datasets?{query_string}" if query_string else "/datasets" resp = await airflow_request("GET", endpoint) resp.raise_for_status() return resp.json()