Skip to main content
Glama
yangkyeongmo

MCP Server for Apache Airflow

by yangkyeongmo

create_variable

Define and store variables in Apache Airflow using a REST API-integrated interface, enabling efficient configuration and management of DAG parameters.

Instructions

Create a variable

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionNo
keyYes
valueYes

Implementation Reference

  • The core handler function that implements the 'create_variable' tool. It constructs a variable request dictionary and uses the Airflow VariableApi to create a new variable, returning the response as text content.
    async def create_variable( key: str, value: str, description: Optional[str] = None ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]: variable_request = { "key": key, "value": value, } if description is not None: variable_request["description"] = description response = variable_api.post_variables(variable_request=variable_request) return [types.TextContent(type="text", text=str(response.to_dict()))]
  • Registers the 'create_variable' tool (along with related variable tools) by including it in the list returned by get_all_functions(), which is imported and used in src/main.py to add tools 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), ]
  • src/main.py:95-96 (registration)
    The loop in main.py that registers all tools from modules like variable.py by calling app.add_tool with Tool.from_function, effectively registering 'create_variable' when the variable functions are loaded.
    for func, name, description, *_ in functions: app.add_tool(Tool.from_function(func, name=name, description=description))

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