update_variable
Modify Airflow variables by key to adjust configuration values or descriptions in your data pipeline deployment.
Instructions
Update a variable by key
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | ||
| value | No | ||
| description | No |
Implementation Reference
- src/airflow/variable.py:59-71 (handler)The async handler function implementing the 'update_variable' tool. It patches an Airflow variable using the VariableApi based on provided key, value, and/or description.async def update_variable( key: str, value: Optional[str] = None, description: Optional[str] = None ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]: update_request = {} if value is not None: update_request["value"] = value if description is not None: update_request["description"] = description response = variable_api.patch_variable( variable_key=key, update_mask=list(update_request.keys()), variable_request=update_request ) return [types.TextContent(type="text", text=str(response.to_dict()))]
- src/airflow/variable.py:11-19 (registration)Registers the 'update_variable' tool (line 17) among other variable tools by returning a tuple (function, name, description, is_read_only) in get_all_functions().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), ]
- src/main.py:90-92 (registration)The generic MCP tool registration loop in main.py that calls app.add_tool for each tool from modules like variable.py, including 'update_variable' when APIType.VARIABLE is selected.for func, name, description, *_ in functions: app.add_tool(func, name=name, description=description)