Skip to main content
Glama

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
NameRequiredDescriptionDefault
limitNo
offsetNo
uri_patternNo

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()

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/call518/MCP-Airflow-API'

If you have feedback or need assistance with the MCP directory API, please join our Discord server