list_connections
Retrieve and manage all connections in Apache Airflow using customizable parameters like limit, offset, and order for efficient monitoring and organization.
Instructions
List all connections
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| offset | No | ||
| order_by | No |
Implementation Reference
- src/airflow/connection.py:23-39 (handler)The main handler function for the 'list_connections' tool. It calls the Airflow ConnectionApi.get_connections with optional pagination parameters and returns the response as text content.async def list_connections( limit: Optional[int] = None, offset: Optional[int] = None, order_by: 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 response = connection_api.get_connections(**kwargs) return [types.TextContent(type="text", text=str(response.to_dict()))]
- src/airflow/connection.py:11-20 (registration)Registers the 'list_connections' tool (and other connection tools) by including it in the list returned by get_all_functions, which is imported and used in src/main.py.def get_all_functions() -> list[tuple[Callable, str, str, bool]]: """Return list of (function, name, description, is_read_only) tuples for registration.""" return [ (list_connections, "list_connections", "List all connections", True), (create_connection, "create_connection", "Create a connection", False), (get_connection, "get_connection", "Get a connection by ID", True), (update_connection, "update_connection", "Update a connection by ID", False), (delete_connection, "delete_connection", "Delete a connection by ID", False), (test_connection, "test_connection", "Test a connection", True), ]
- src/main.py:95-97 (registration)Generic registration loop where tools from get_all_functions (including list_connections) are added to the MCP app using Tool.from_function.for func, name, description, *_ in functions: app.add_tool(Tool.from_function(func, name=name, description=description))
- src/main.py:26-26 (registration)Maps APIType.CONNECTION to get_connection_functions (alias for connection.py's get_all_functions), enabling its tools to be loaded.APIType.CONNECTION: get_connection_functions,