Skip to main content
Glama

app_configuration_kv_write

Write or update key-value pairs in Azure App Configuration to manage application settings and feature flags.

Instructions

Write or update a key-value in Azure App Configuration

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesThe key to write
valueYesThe value to store
labelNoThe label for the key-value (optional)
content_typeNoContent type of the value (optional, e.g. 'application/json')

Implementation Reference

  • Implements the core logic for the app_configuration_kv_write tool: creates a ConfigurationSetting with provided key, value, label, and content_type, then calls set_configuration_setting on the Azure App Configuration client to write or update the key-value.
    elif name == "app_configuration_kv_write":
        from azure.appconfiguration import ConfigurationSetting
        
        # Create a configuration setting
        setting = ConfigurationSetting(
            key=arguments["key"],
            value=arguments["value"],
            label=arguments.get("label", None),
            content_type=arguments.get("content_type", None)
        )
        
        # Set or update the configuration setting
        result = app_config_client.set_configuration_setting(setting)
        
        # Format result for display
        response = {
            "key": result.key,
            "value": result.value,
            "content_type": result.content_type,
            "label": result.label,
            "etag": result.etag,
            "last_modified": result.last_modified.isoformat() if result.last_modified else None
        }
  • Defines the Tool object including inputSchema for app_configuration_kv_write, specifying required key and value, optional label and content_type.
        name="app_configuration_kv_write",
        description="Write or update a key-value in Azure App Configuration",
        inputSchema={
            "type": "object",
            "properties": {
                "key": {
                    "type": "string",
                    "description": "The key to write",
                },
                "value": {
                    "type": "string",
                    "description": "The value to store",
                },
                "label": {
                    "type": "string",
                    "description": "The label for the key-value (optional)",
                },
                "content_type": {
                    "type": "string",
                    "description": "Content type of the value (optional, e.g. 'application/json')",
                },
            },
            "required": ["key", "value"],
        },
    ),
  • MCP server tool registration handler that returns the list of all Azure tools via get_azure_tools(), which includes app_configuration_kv_write.
    async def list_tools() -> list[Tool]:
        """List available Azure tools"""
        logger.debug("Handling list_tools request")
        return get_azure_tools()  # Use get_azure_tools
  • Function that returns the list of App Configuration tools, including the app_configuration_kv_write tool with its schema; called by get_azure_tools().
    def get_app_configuration_tools() -> list[Tool]:
        return [
            Tool(
                name="app_configuration_kv_read",
                description="Read key-values from Azure App Configuration",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "key": {
                            "type": "string",
                            "description": "The key to read (optional, use * for wildcards, e.g. 'app1/*')",
                        },
                        "label": {
                            "type": "string",
                            "description": "The label filter (optional, use '\\0' for no label, '*' for any label)",
                        },
                    },
                    "required": [],
                },
            ),
            Tool(
                name="app_configuration_kv_write",
                description="Write or update a key-value in Azure App Configuration",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "key": {
                            "type": "string",
                            "description": "The key to write",
                        },
                        "value": {
                            "type": "string",
                            "description": "The value to store",
                        },
                        "label": {
                            "type": "string",
                            "description": "The label for the key-value (optional)",
                        },
                        "content_type": {
                            "type": "string",
                            "description": "Content type of the value (optional, e.g. 'application/json')",
                        },
                    },
                    "required": ["key", "value"],
                },
            ),
            Tool(
                name="app_configuration_kv_delete",
                description="Delete a key-value from Azure App Configuration",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "key": {
                            "type": "string",
                            "description": "The key to delete",
                        },
                        "label": {
                            "type": "string",
                            "description": "The label of the key-value to delete (optional)",
                        },
                    },
                    "required": ["key"],
                },
            ),
        ]
  • Helper method in AzureResourceManager to create and cache the AzureAppConfigurationClient used by the app_configuration tools.
    def get_app_configuration_client(
        self, endpoint: str | None = None
    ) -> AzureAppConfigurationClient:
        """Get an Azure App Configuration client using AzureCliCredential."""
        try:
            logger.info(f"Creating AzureAppConfigurationClient")
            endpoint = endpoint or os.getenv("AZURE_APP_CONFIGURATION_ENDPOINT")
            if not endpoint:
                raise ValueError(
                    "Azure App Configuration endpoint is not specified and not set in the environment."
                )
    
            return AzureAppConfigurationClient(base_url=endpoint, credential=self.credential)
        except Exception as e:
            logger.error(f"Failed to create AzureAppConfigurationClient: {e}")
            raise RuntimeError(f"Failed to create AzureAppConfigurationClient: {e}")

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/mashriram/azure_mcp_server'

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