get_variable
Retrieve specific Airflow variables by their key, including metadata such as value and description, simplifying variable management and configuration within Apache Airflow clusters.
Instructions
[Tool Role]: Retrieves a specific variable by its key from Airflow.
Args: variable_key: The key of the variable to retrieve
Returns: Variable information including key, value, and description
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| variable_key | Yes |
Implementation Reference
- The core handler implementation for the 'get_variable' tool. This async function fetches the value of a specific Airflow variable using the Airflow REST API endpoint `/variables/{variable_key}`. The @mcp.tool() decorator both defines the tool schema via type hints/docstring and registers it when executed.@mcp.tool() async def get_variable(variable_key: str) -> Dict[str, Any]: """[Tool Role]: Gets the value of a specific variable.""" resp = await airflow_request("GET", f"/variables/{variable_key}") resp.raise_for_status() return resp.json()
- src/mcp_airflow_api/tools/v1_tools.py:23-24 (registration)Registration call in v1_tools.py that invokes register_common_tools(mcp), which defines and registers the get_variable tool (among 56 common tools) for Airflow API v1.common_tools.register_common_tools(mcp)
- src/mcp_airflow_api/tools/v2_tools.py:24-24 (registration)Registration call in v2_tools.py that invokes register_common_tools(mcp), which defines and registers the get_variable tool (among 56 common tools) for Airflow API v2.common_tools.register_common_tools(mcp)