Skip to main content
Glama

Azure MCP Server

Official
MIT License
1,161
  • Linux
  • Apple
KeyValueDeleteCommand.cs2.37 kB
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using AzureMcp.AppConfig.Options.KeyValue; using AzureMcp.AppConfig.Services; using AzureMcp.Core.Commands; using AzureMcp.Core.Services.Telemetry; using Microsoft.Extensions.Logging; namespace AzureMcp.AppConfig.Commands.KeyValue; public sealed class KeyValueDeleteCommand(ILogger<KeyValueDeleteCommand> logger) : BaseKeyValueCommand<KeyValueDeleteOptions>() { private const string CommandTitle = "Delete App Configuration Key-Value Setting"; private readonly ILogger<KeyValueDeleteCommand> _logger = logger; public override string Name => "delete"; public override string Description => """ Delete a key-value pair from an App Configuration store. This command removes the specified key-value pair from the store. If a label is specified, only the labeled version is deleted. If no label is specified, the key-value with the matching key and the default label will be deleted. """; public override string Title => CommandTitle; public override ToolMetadata Metadata => new() { Destructive = true, ReadOnly = false }; public override async Task<CommandResponse> ExecuteAsync(CommandContext context, ParseResult parseResult) { var options = BindOptions(parseResult); try { if (!Validate(parseResult.CommandResult, context.Response).IsValid) { return context.Response; } var appConfigService = context.GetService<IAppConfigService>(); await appConfigService.DeleteKeyValue( options.Account!, options.Key!, options.Subscription!, options.Tenant, options.RetryPolicy, options.Label); var result = new KeyValueDeleteCommandResult(options.Key, options.Label); context.Response.Results = ResponseResult.Create(result, AppConfigJsonContext.Default.KeyValueDeleteCommandResult); } catch (Exception ex) { _logger.LogError(ex, "An exception occurred deleting value. Key: {Key}.", options.Key); HandleException(context, ex); } return context.Response; } internal record KeyValueDeleteCommandResult(string? Key, string? Label); }

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/Azure/azure-mcp'

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