Skip to main content
Glama
nikhil-ganage

MCP Server Airflow Token

create_variable

Create and store variables in Apache Airflow for use in workflows, enabling configuration management and secure data handling across deployments.

Instructions

Create a variable

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYes
valueYes
descriptionNo

Implementation Reference

  • The asynchronous function implementing the create_variable tool. It creates a new Airflow variable using the VariableApi by posting a request with key, value, and optional description.
    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()))]
  • Module-level function that defines and returns the list of variable-related tools, including the create_variable tool, for registration into the main 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:80-91 (registration)
    The code in the main function that retrieves the list of functions (including create_variable via get_variable_functions) and registers them as MCP tools using app.add_tool.
    get_function = APITYPE_TO_FUNCTIONS[APIType(api)]
    try:
        functions = get_function()
    except NotImplementedError:
        continue
    
    # Filter functions for read-only mode if requested
    if read_only:
        functions = filter_functions_for_read_only(functions)
    
    for func, name, description, *_ in functions:
        app.add_tool(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/nikhil-ganage/mcp-server-airflow-token'

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