Skip to main content
Glama
yangkyeongmo

MCP Server for Apache Airflow

by yangkyeongmo

update_connection

Modify connection details in Apache Airflow using the MCP Server, allowing users to update attributes like host, port, login, password, and schema by specifying the connection ID.

Instructions

Update a connection by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
conn_idYes
conn_typeNo
extraNo
hostNo
loginNo
passwordNo
portNo
schemaNo

Implementation Reference

  • The core handler function implementing the logic to update an Airflow connection using the ConnectionApi.patch_connection method. It constructs an update request from provided optional parameters and returns the response.
    async def update_connection( conn_id: str, conn_type: Optional[str] = None, host: Optional[str] = None, port: Optional[int] = None, login: Optional[str] = None, password: Optional[str] = None, schema: Optional[str] = None, extra: Optional[str] = None, ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]: update_request = {} if conn_type is not None: update_request["conn_type"] = conn_type if host is not None: update_request["host"] = host if port is not None: update_request["port"] = port if login is not None: update_request["login"] = login if password is not None: update_request["password"] = password if schema is not None: update_request["schema"] = schema if extra is not None: update_request["extra"] = extra response = connection_api.patch_connection( connection_id=conn_id, update_mask=list(update_request.keys()), connection_request=update_request ) return [types.TextContent(type="text", text=str(response.to_dict()))]
  • The get_all_functions() in the connection module defines and returns the tuple for update_connection (marked as non-read-only) among other connection tools, used for registration.
    def get_all_functions() -> list[tuple[Callable, str, str, bool]]: """Return list of (function, name, description, is_read_only) tuples for registration.""" return [ (list_connections, "list_connections", "List all connections", True), (create_connection, "create_connection", "Create a connection", False), (get_connection, "get_connection", "Get a connection by ID", True), (update_connection, "update_connection", "Update a connection by ID", False), (delete_connection, "delete_connection", "Delete a connection by ID", False), (test_connection, "test_connection", "Test a connection", True), ]
  • src/main.py:95-97 (registration)
    The generic registration loop in main.py that iterates over functions from selected APIs (including connection) and adds them to the MCP app using Tool.from_function.
    for func, name, description, *_ in functions: app.add_tool(Tool.from_function(func, name=name, description=description))
  • src/main.py:7-7 (registration)
    Import of the connection module's get_all_functions in main.py, aliased for use in API type mapping.
    from src.airflow.connection import get_all_functions as get_connection_functions

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