get_variable
Retrieve a specific variable by its key from Apache Airflow using the MCP Server, enabling streamlined access to stored configurations and metadata.
Instructions
Get a variable by key
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes |
Implementation Reference
- src/airflow/variable.py:54-56 (handler)The async handler function that implements the core logic of the 'get_variable' tool. It calls the Airflow VariableApi to retrieve the variable by key and formats the response as MCP TextContent.async def get_variable(key: str) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]: response = variable_api.get_variable(variable_key=key) return [types.TextContent(type="text", text=str(response.to_dict()))]
- src/airflow/variable.py:11-19 (registration)The get_all_functions() provides the registration details for all Variable tools, including the specific tuple for 'get_variable' used by main.py to add the tool to the MCP server.def get_all_functions() -> list[tuple[Callable, str, str, bool]]: """Return list of (function, name, description, is_read_only) tuples for registration.""" return [ (list_variables, "list_variables", "List all variables", True), (create_variable, "create_variable", "Create a variable", False), (get_variable, "get_variable", "Get a variable by key", True), (update_variable, "update_variable", "Update a variable by key", False), (delete_variable, "delete_variable", "Delete a variable by key", False), ]