get_datasets
Retrieve and filter datasets from Apache Airflow with pagination and sorting options to manage data dependencies in workflows.
Instructions
List datasets
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| offset | No | ||
| order_by | No | ||
| uri_pattern | No | ||
| dag_ids | No |
Implementation Reference
- src/airflow/dataset.py:42-64 (handler)The async handler function implementing the 'get_datasets' tool. It constructs query parameters and calls the Airflow DatasetApi to list datasets, returning the result as MCP TextContent.async def get_datasets( limit: Optional[int] = None, offset: Optional[int] = None, order_by: Optional[str] = None, uri_pattern: Optional[str] = None, dag_ids: Optional[str] = None, ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]: # Build parameters dictionary kwargs: Dict[str, Any] = {} if limit is not None: kwargs["limit"] = limit if offset is not None: kwargs["offset"] = offset if order_by is not None: kwargs["order_by"] = order_by if uri_pattern is not None: kwargs["uri_pattern"] = uri_pattern if dag_ids is not None: kwargs["dag_ids"] = dag_ids response = dataset_api.get_datasets(**kwargs) return [types.TextContent(type="text", text=str(response.to_dict()))]
- src/airflow/dataset.py:14-14 (registration)The registration entry for the 'get_datasets' tool within the get_all_functions() list, specifying the function, name, description, and read-only status.(get_datasets, "get_datasets", "List datasets", True),
- src/main.py:95-96 (registration)The registration loop in main.py that adds the 'get_datasets' tool (along with others) to the MCP server application using fastmcp's Tool.from_function.for func, name, description, *_ in functions: app.add_tool(Tool.from_function(func, name=name, description=description))