Skip to main content
Glama
yangkyeongmo

MCP Server for Apache Airflow

by yangkyeongmo

get_pools

Retrieve and list Apache Airflow connection pools to manage database connections and monitor system resources.

Instructions

List pools

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
offsetNo
order_byNo

Implementation Reference

  • The handler function for the 'get_pools' tool. It accepts optional parameters for limit, offset, and order_by, calls the Airflow PoolApi to retrieve pools, and returns the response as text content.
    async def get_pools(
        limit: Optional[int] = None,
        offset: Optional[int] = None,
        order_by: Optional[str] = None,
    ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]:
        """
        List pools.
    
        Args:
            limit: The numbers of items to return.
            offset: The number of items to skip before starting to collect the result set.
            order_by: The name of the field to order the results by. Prefix a field name with `-` to reverse the sort order.
    
        Returns:
            A list of pools.
        """
        # 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 = pool_api.get_pools(**kwargs)
        return [types.TextContent(type="text", text=str(response.to_dict()))]
  • The get_all_functions in pool.py registers the 'get_pools' tool by including it in the list of tuples returned for MCP tool registration. This list 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 [
            (get_pools, "get_pools", "List pools", True),
            (get_pool, "get_pool", "Get a pool by name", True),
            (delete_pool, "delete_pool", "Delete a pool", False),
            (post_pool, "post_pool", "Create a pool", False),
            (patch_pool, "patch_pool", "Update a pool", False),
        ]
  • src/main.py:95-96 (registration)
    Generic registration loop in main.py where tools from get_all_functions (including get_pools) 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))
  • Initialization of the pool_api client used by the get_pools handler to interact with Airflow's Pool API.
    pool_api = PoolApi(api_client)

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/yangkyeongmo/mcp-server-apache-airflow'

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