diff --git a/core/Azure.Mcp.Core/src/Areas/Group/GroupSetup.cs b/core/Azure.Mcp.Core/src/Areas/Group/GroupSetup.cs index f686ed834a..7528bcfa6c 100644 --- a/core/Azure.Mcp.Core/src/Areas/Group/GroupSetup.cs +++ b/core/Azure.Mcp.Core/src/Areas/Group/GroupSetup.cs @@ -27,15 +27,13 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) var group = new CommandGroup(Name, "Resource group operations - Commands for listing and managing Azure resource groups and their resources in your subscriptions.", Title); // Register Group commands - var listCommand = serviceProvider.GetRequiredService(); - group.AddCommand(listCommand.Name, listCommand); + group.AddCommand(serviceProvider.GetRequiredService()); // Register Resource sub-group var resource = new CommandGroup("resource", "Resource operations - Commands for listing resources within a resource group."); group.AddSubGroup(resource); - var resourceListCommand = serviceProvider.GetRequiredService(); - resource.AddCommand(resourceListCommand.Name, resourceListCommand); + resource.AddCommand(serviceProvider.GetRequiredService()); return group; } diff --git a/core/Azure.Mcp.Core/src/Areas/Subscription/SubscriptionSetup.cs b/core/Azure.Mcp.Core/src/Areas/Subscription/SubscriptionSetup.cs index 766c391f9b..144ff64a85 100644 --- a/core/Azure.Mcp.Core/src/Areas/Subscription/SubscriptionSetup.cs +++ b/core/Azure.Mcp.Core/src/Areas/Subscription/SubscriptionSetup.cs @@ -28,8 +28,7 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) var subscription = new CommandGroup(Name, "Azure subscription operations - Commands for listing and managing Azure subscriptions accessible to your account.", Title); // Register Subscription commands - var subscriptionListCommand = serviceProvider.GetRequiredService(); - subscription.AddCommand(subscriptionListCommand.Name, subscriptionListCommand); + subscription.AddCommand(serviceProvider.GetRequiredService()); return subscription; } diff --git a/core/Azure.Mcp.Core/tests/Azure.Mcp.Core.UnitTests/Areas/Server/Commands/ToolLoading/NamespaceToolLoaderTests.cs b/core/Azure.Mcp.Core/tests/Azure.Mcp.Core.UnitTests/Areas/Server/Commands/ToolLoading/NamespaceToolLoaderTests.cs index 0a57015a94..b4151bb591 100644 --- a/core/Azure.Mcp.Core/tests/Azure.Mcp.Core.UnitTests/Areas/Server/Commands/ToolLoading/NamespaceToolLoaderTests.cs +++ b/core/Azure.Mcp.Core/tests/Azure.Mcp.Core.UnitTests/Areas/Server/Commands/ToolLoading/NamespaceToolLoaderTests.cs @@ -147,11 +147,11 @@ public async Task ListToolsHandler_WithReadOnlyOption_ReturnsOnlyReadOnlyTools() var storageGroup = new CommandGroup("storage", "Storage commands"); var storageCommand = Substitute.For(); storageCommand.Metadata.Returns(new ToolMetadata() { ReadOnly = true }); - storageGroup.AddCommand("readonly", storageCommand); + storageGroup.Commands["readonly"] = storageCommand; var keyvaultGroup = new CommandGroup("keyvault", "Key Vault commands"); var keyvaultCommand = Substitute.For(); keyvaultCommand.Metadata.Returns(new ToolMetadata() { ReadOnly = false }); - keyvaultGroup.AddCommand("notreadonly", keyvaultCommand); + keyvaultGroup.Commands["notreadonly"] = keyvaultCommand; rootGroup.SubGroup.AddRange([storageGroup, keyvaultGroup]); commandFactory.RootGroup.Returns(rootGroup); @@ -182,11 +182,11 @@ public async Task ListToolsHandler_WithIsHttpOption_DoesNotReturnLocalRequiredTo var stroageGroup = new CommandGroup("storage", "Storage commands"); var storageCommand = Substitute.For(); storageCommand.Metadata.Returns(new ToolMetadata() { LocalRequired = true }); - stroageGroup.AddCommand("localrequired", storageCommand); + stroageGroup.Commands["localrequired"] = storageCommand; var keyvaultGroup = new CommandGroup("keyvault", "Key Vault commands"); var keyvaultCommand = Substitute.For(); keyvaultCommand.Metadata.Returns(new ToolMetadata() { LocalRequired = false }); - keyvaultGroup.AddCommand("notlocalrequired", keyvaultCommand); + keyvaultGroup.Commands["notlocalrequired"] = keyvaultCommand; rootGroup.SubGroup.AddRange([stroageGroup, keyvaultGroup]); commandFactory.RootGroup.Returns(rootGroup); diff --git a/core/Microsoft.Mcp.Core/src/Areas/Server/Commands/Discovery/ConsolidatedToolDiscoveryStrategy.cs b/core/Microsoft.Mcp.Core/src/Areas/Server/Commands/Discovery/ConsolidatedToolDiscoveryStrategy.cs index d9eb496189..8f33250165 100644 --- a/core/Microsoft.Mcp.Core/src/Areas/Server/Commands/Discovery/ConsolidatedToolDiscoveryStrategy.cs +++ b/core/Microsoft.Mcp.Core/src/Areas/Server/Commands/Discovery/ConsolidatedToolDiscoveryStrategy.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using System.Reflection; using Azure.Mcp.Core.Commands; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -253,7 +252,7 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) // Add all matching commands to this group foreach (var cmd in _matchingCommands) { - commandGroup.AddCommand(cmd.Key, cmd.Value); + commandGroup.AddCommand(cmd.Value); } // Set tool metadata from the consolidated tool definition diff --git a/core/Microsoft.Mcp.Core/src/Areas/Server/ServerSetup.cs b/core/Microsoft.Mcp.Core/src/Areas/Server/ServerSetup.cs index ce98abff86..9449f48682 100644 --- a/core/Microsoft.Mcp.Core/src/Areas/Server/ServerSetup.cs +++ b/core/Microsoft.Mcp.Core/src/Areas/Server/ServerSetup.cs @@ -40,14 +40,9 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) var mcpServer = new CommandGroup(Name, "MCP Server operations - Commands for managing and interacting with the MCP Server.", Title); // Register MCP Server commands - var startCommand = serviceProvider.GetRequiredService(); - mcpServer.AddCommand(startCommand.Name, startCommand); - - var infoCommand = serviceProvider.GetRequiredService(); - mcpServer.AddCommand(infoCommand.Name, infoCommand); - - var pluginTelemetryCommand = serviceProvider.GetRequiredService(); - mcpServer.AddCommand(pluginTelemetryCommand.Name, pluginTelemetryCommand); + mcpServer.AddCommand(serviceProvider.GetRequiredService()); + mcpServer.AddCommand(serviceProvider.GetRequiredService()); + mcpServer.AddCommand(serviceProvider.GetRequiredService()); return mcpServer; } diff --git a/core/Microsoft.Mcp.Core/src/Areas/Tools/ToolsSetup.cs b/core/Microsoft.Mcp.Core/src/Areas/Tools/ToolsSetup.cs index bb9ada903e..4471ee1f45 100644 --- a/core/Microsoft.Mcp.Core/src/Areas/Tools/ToolsSetup.cs +++ b/core/Microsoft.Mcp.Core/src/Areas/Tools/ToolsSetup.cs @@ -26,8 +26,7 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) // Create Tools command group var tools = new CommandGroup(Name, "CLI tools operations - Commands for discovering and exploring the functionality available in this CLI tool.", Title); - var list = serviceProvider.GetRequiredService(); - tools.AddCommand(list.Name, list); + tools.AddCommand(serviceProvider.GetRequiredService()); return tools; } diff --git a/core/Microsoft.Mcp.Core/src/Commands/CommandGroup.cs b/core/Microsoft.Mcp.Core/src/Commands/CommandGroup.cs index e3e40b9032..548e63e301 100644 --- a/core/Microsoft.Mcp.Core/src/Commands/CommandGroup.cs +++ b/core/Microsoft.Mcp.Core/src/Commands/CommandGroup.cs @@ -13,26 +13,7 @@ public class CommandGroup(string name, string description, string? title = null) public Command Command { get; } = new Command(name, description); public ToolMetadata? ToolMetadata { get; set; } - public void AddCommand(string path, IBaseCommand command) - { - // Split on first dot to get group and remaining path - var parts = path.Split(['.'], 2); - - if (parts.Length == 1) - { - // This is a direct command for this group - Commands[path] = command; - } - else - { - // Find or create the subgroup - var subGroup = SubGroup.FirstOrDefault(g => g.Name == parts[0]) ?? - throw new InvalidOperationException($"Subgroup {parts[0]} not found. Group must be registered before commands."); - - // Recursively add command to subgroup - subGroup.AddCommand(parts[1], command); - } - } + public void AddCommand(IBaseCommand command) => Commands[command.Name] = command; public void AddSubGroup(CommandGroup subGroup) { diff --git a/servers/Azure.Mcp.Server/docs/new-command.md b/servers/Azure.Mcp.Server/docs/new-command.md index 064ccec636..eeb8cc864c 100644 --- a/servers/Azure.Mcp.Server/docs/new-command.md +++ b/servers/Azure.Mcp.Server/docs/new-command.md @@ -1383,20 +1383,20 @@ Guidelines: ### 9. Command Registration ```csharp -private void RegisterCommands(CommandGroup rootGroup, ILoggerFactory loggerFactory) +private CommandGroup RegisterCommands(IServiceProvider serviceProvider) { var service = new CommandGroup( "{Toolset}", - "{Toolset} operations"); - rootGroup.AddSubGroup(service); + "{Toolset} operations description"); var resource = new CommandGroup( "{resource}", - "{Resource} operations"); + "{Resource} operations description"); service.AddSubGroup(resource); - resource.AddCommand("{operation}", new {Resource}{Operation}Command( - loggerFactory.CreateLogger<{Resource}{Operation}Command>())); + resource.AddCommand(serviceProvider.GetRequiredService<{Resource}{Operation}Command>()); + + return service; } ``` diff --git a/tools/Azure.Mcp.Tools.Acr/src/AcrSetup.cs b/tools/Azure.Mcp.Tools.Acr/src/AcrSetup.cs index 5e59c4da16..1ff475d2b6 100644 --- a/tools/Azure.Mcp.Tools.Acr/src/AcrSetup.cs +++ b/tools/Azure.Mcp.Tools.Acr/src/AcrSetup.cs @@ -30,15 +30,12 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) var registry = new CommandGroup("registry", "Container Registry resource operations - Commands for listing and managing Container Registry resources in your Azure subscription."); acr.AddSubGroup(registry); - var registryList = serviceProvider.GetRequiredService(); - registry.AddCommand(registryList.Name, registryList); + registry.AddCommand(serviceProvider.GetRequiredService()); var repository = new CommandGroup("repository", "Container Registry repository operations - Commands for listing and managing repositories within a Container Registry."); registry.AddSubGroup(repository); - - var repositoryList = serviceProvider.GetRequiredService(); - repository.AddCommand(repositoryList.Name, repositoryList); + repository.AddCommand(serviceProvider.GetRequiredService()); return acr; } diff --git a/tools/Azure.Mcp.Tools.Advisor/src/AdvisorSetup.cs b/tools/Azure.Mcp.Tools.Advisor/src/AdvisorSetup.cs index c06a00fef1..99b789311d 100644 --- a/tools/Azure.Mcp.Tools.Advisor/src/AdvisorSetup.cs +++ b/tools/Azure.Mcp.Tools.Advisor/src/AdvisorSetup.cs @@ -31,8 +31,7 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) advisor.AddSubGroup(recommendation); // Register Advisor commands - var recommendationList = serviceProvider.GetRequiredService(); - recommendation.AddCommand(recommendationList.Name, recommendationList); + recommendation.AddCommand(serviceProvider.GetRequiredService()); return advisor; } diff --git a/tools/Azure.Mcp.Tools.Aks/src/AksSetup.cs b/tools/Azure.Mcp.Tools.Aks/src/AksSetup.cs index 37f5e9a2e3..b202db4ce9 100644 --- a/tools/Azure.Mcp.Tools.Aks/src/AksSetup.cs +++ b/tools/Azure.Mcp.Tools.Aks/src/AksSetup.cs @@ -35,11 +35,8 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) aks.AddSubGroup(nodepool); // Register AKS commands - var clusterGet = serviceProvider.GetRequiredService(); - cluster.AddCommand(clusterGet.Name, clusterGet); - - var nodepoolGet = serviceProvider.GetRequiredService(); - nodepool.AddCommand(nodepoolGet.Name, nodepoolGet); + cluster.AddCommand(serviceProvider.GetRequiredService()); + nodepool.AddCommand(serviceProvider.GetRequiredService()); return aks; } diff --git a/tools/Azure.Mcp.Tools.AppConfig/src/AppConfigSetup.cs b/tools/Azure.Mcp.Tools.AppConfig/src/AppConfigSetup.cs index 4d376b4005..c6410ecba9 100644 --- a/tools/Azure.Mcp.Tools.AppConfig/src/AppConfigSetup.cs +++ b/tools/Azure.Mcp.Tools.AppConfig/src/AppConfigSetup.cs @@ -47,18 +47,13 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) keyValue.AddSubGroup(lockGroup); // Register AppConfig commands - var accountList = serviceProvider.GetRequiredService(); - accounts.AddCommand(accountList.Name, accountList); - - var keyValueDelete = serviceProvider.GetRequiredService(); - keyValue.AddCommand(keyValueDelete.Name, keyValueDelete); - var keyValueGet = serviceProvider.GetRequiredService(); - keyValue.AddCommand(keyValueGet.Name, keyValueGet); - var keyValueSet = serviceProvider.GetRequiredService(); - keyValue.AddCommand(keyValueSet.Name, keyValueSet); - - var keyValueLockSet = serviceProvider.GetRequiredService(); - lockGroup.AddCommand(keyValueLockSet.Name, keyValueLockSet); + accounts.AddCommand(serviceProvider.GetRequiredService()); + + keyValue.AddCommand(serviceProvider.GetRequiredService()); + keyValue.AddCommand(serviceProvider.GetRequiredService()); + keyValue.AddCommand(serviceProvider.GetRequiredService()); + + lockGroup.AddCommand(serviceProvider.GetRequiredService()); return appConfig; } diff --git a/tools/Azure.Mcp.Tools.AppLens/src/AppLensSetup.cs b/tools/Azure.Mcp.Tools.AppLens/src/AppLensSetup.cs index 9572fdfcbc..9e5b97dfde 100644 --- a/tools/Azure.Mcp.Tools.AppLens/src/AppLensSetup.cs +++ b/tools/Azure.Mcp.Tools.AppLens/src/AppLensSetup.cs @@ -32,8 +32,7 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) // Resource commands var resourceGroup = new CommandGroup("resource", "Resource operations - Commands for diagnosing specific Azure resources."); - var diagnose = serviceProvider.GetRequiredService(); - resourceGroup.AddCommand(diagnose.Name, diagnose); + resourceGroup.AddCommand(serviceProvider.GetRequiredService()); applens.AddSubGroup(resourceGroup); diff --git a/tools/Azure.Mcp.Tools.AppService/src/AppServiceSetup.cs b/tools/Azure.Mcp.Tools.AppService/src/AppServiceSetup.cs index cebd958b57..978ac2e22b 100644 --- a/tools/Azure.Mcp.Tools.AppService/src/AppServiceSetup.cs +++ b/tools/Azure.Mcp.Tools.AppService/src/AppServiceSetup.cs @@ -42,46 +42,37 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) // Add database commands // Register the 'add' command for database connections, allowing users to configure a new database connection for an App Service web app. - var databaseAdd = serviceProvider.GetRequiredService(); - database.AddCommand(databaseAdd.Name, databaseAdd); + database.AddCommand(serviceProvider.GetRequiredService()); // Create webapp subgroup var webapp = new CommandGroup("webapp", "Operations for managing Azure App Service web apps"); appService.AddSubGroup(webapp); // Add webapp commands - var webappGet = serviceProvider.GetRequiredService(); - webapp.AddCommand(webappGet.Name, webappGet); + webapp.AddCommand(serviceProvider.GetRequiredService()); // Add deployment subgroup var deployment = new CommandGroup("deployment", "Operations for managing Azure App Service web app deployments"); webapp.AddSubGroup(deployment); // Add deployment commands - var deploymentGet = serviceProvider.GetRequiredService(); - deployment.AddCommand(deploymentGet.Name, deploymentGet); + deployment.AddCommand(serviceProvider.GetRequiredService()); // Add diagnostic subgroup under webapp var diagnostic = new CommandGroup("diagnostic", "Operations for diagnosing Azure App Service web apps"); webapp.AddSubGroup(diagnostic); // Add diagnostic commands - var detectorDiagnose = serviceProvider.GetRequiredService(); - diagnostic.AddCommand(detectorDiagnose.Name, detectorDiagnose); - - var detectorList = serviceProvider.GetRequiredService(); - diagnostic.AddCommand(detectorList.Name, detectorList); + diagnostic.AddCommand(serviceProvider.GetRequiredService()); + diagnostic.AddCommand(serviceProvider.GetRequiredService()); // Add settings subgroup under webapp var settings = new CommandGroup("settings", "Operations for managing Azure App Service web settings"); webapp.AddSubGroup(settings); // Add settings commands - var appSettingsGet = serviceProvider.GetRequiredService(); - settings.AddCommand(appSettingsGet.Name, appSettingsGet); - - var appSettingsUpdate = serviceProvider.GetRequiredService(); - settings.AddCommand(appSettingsUpdate.Name, appSettingsUpdate); + settings.AddCommand(serviceProvider.GetRequiredService()); + settings.AddCommand(serviceProvider.GetRequiredService()); return appService; } diff --git a/tools/Azure.Mcp.Tools.ApplicationInsights/src/ApplicationInsightsSetup.cs b/tools/Azure.Mcp.Tools.ApplicationInsights/src/ApplicationInsightsSetup.cs index aa0edb8a0f..a2b45c2687 100644 --- a/tools/Azure.Mcp.Tools.ApplicationInsights/src/ApplicationInsightsSetup.cs +++ b/tools/Azure.Mcp.Tools.ApplicationInsights/src/ApplicationInsightsSetup.cs @@ -38,8 +38,7 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) var recommendation = new CommandGroup("recommendation", "Application Insights recommendation operations - list recommendation targets (components)."); group.AddSubGroup(recommendation); - var recommendationList = serviceProvider.GetRequiredService(); - recommendation.AddCommand(recommendationList.Name, recommendationList); + recommendation.AddCommand(serviceProvider.GetRequiredService()); return group; } diff --git a/tools/Azure.Mcp.Tools.Authorization/src/AuthorizationSetup.cs b/tools/Azure.Mcp.Tools.Authorization/src/AuthorizationSetup.cs index bd5911db6d..d1b49d17e3 100644 --- a/tools/Azure.Mcp.Tools.Authorization/src/AuthorizationSetup.cs +++ b/tools/Azure.Mcp.Tools.Authorization/src/AuthorizationSetup.cs @@ -34,8 +34,7 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) authorization.AddSubGroup(roleAssignment); // Register role assignment commands - var command = serviceProvider.GetRequiredService(); - roleAssignment.AddCommand(command.Name, command); + roleAssignment.AddCommand(serviceProvider.GetRequiredService()); return authorization; } diff --git a/tools/Azure.Mcp.Tools.AzureBestPractices/src/AzureBestPracticesSetup.cs b/tools/Azure.Mcp.Tools.AzureBestPractices/src/AzureBestPracticesSetup.cs index 7a71b0fd6d..feee95701f 100644 --- a/tools/Azure.Mcp.Tools.AzureBestPractices/src/AzureBestPracticesSetup.cs +++ b/tools/Azure.Mcp.Tools.AzureBestPractices/src/AzureBestPracticesSetup.cs @@ -43,11 +43,8 @@ Only call this function when you are confident the user is discussing Azure (inc Title ); - var bestPracticesCommand = serviceProvider.GetRequiredService(); - var aiAppBestPracticesCommand = serviceProvider.GetRequiredService(); - - bestPractices.AddCommand(bestPracticesCommand.Name, bestPracticesCommand); - bestPractices.AddCommand(aiAppBestPracticesCommand.Name, aiAppBestPracticesCommand); + bestPractices.AddCommand(serviceProvider.GetRequiredService()); + bestPractices.AddCommand(serviceProvider.GetRequiredService()); return bestPractices; } diff --git a/tools/Azure.Mcp.Tools.AzureIsv/src/AzureIsvSetup.cs b/tools/Azure.Mcp.Tools.AzureIsv/src/AzureIsvSetup.cs index 1262b71574..70f967014c 100644 --- a/tools/Azure.Mcp.Tools.AzureIsv/src/AzureIsvSetup.cs +++ b/tools/Azure.Mcp.Tools.AzureIsv/src/AzureIsvSetup.cs @@ -30,8 +30,7 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) var monitoredResources = new CommandGroup("monitoredresources", "Datadog monitored resources operations - Commands for listing monitored resources in a specific Datadog monitor."); datadog.AddSubGroup(monitoredResources); - var monitoredResourcesList = serviceProvider.GetRequiredService(); - monitoredResources.AddCommand(monitoredResourcesList.Name, monitoredResourcesList); + monitoredResources.AddCommand(serviceProvider.GetRequiredService()); return datadog; } diff --git a/tools/Azure.Mcp.Tools.AzureMigrate/src/AzureMigrateSetup.cs b/tools/Azure.Mcp.Tools.AzureMigrate/src/AzureMigrateSetup.cs index 36f3cf9987..279a41434a 100644 --- a/tools/Azure.Mcp.Tools.AzureMigrate/src/AzureMigrateSetup.cs +++ b/tools/Azure.Mcp.Tools.AzureMigrate/src/AzureMigrateSetup.cs @@ -55,11 +55,8 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) azureMigrate.AddSubGroup(platformLandingZone); // Register platform landing zone commands - var platformLandingZoneGetGuidance = serviceProvider.GetRequiredService(); - platformLandingZone.AddCommand(platformLandingZoneGetGuidance.Name, platformLandingZoneGetGuidance); - - var platformLandingZoneRequest = serviceProvider.GetRequiredService(); - platformLandingZone.AddCommand(platformLandingZoneRequest.Name, platformLandingZoneRequest); + platformLandingZone.AddCommand(serviceProvider.GetRequiredService()); + platformLandingZone.AddCommand(serviceProvider.GetRequiredService()); return azureMigrate; } diff --git a/tools/Azure.Mcp.Tools.AzureTerraformBestPractices/src/AzureTerraformBestPracticesSetup.cs b/tools/Azure.Mcp.Tools.AzureTerraformBestPractices/src/AzureTerraformBestPracticesSetup.cs index 3c500ebdcf..6445b55036 100644 --- a/tools/Azure.Mcp.Tools.AzureTerraformBestPractices/src/AzureTerraformBestPracticesSetup.cs +++ b/tools/Azure.Mcp.Tools.AzureTerraformBestPractices/src/AzureTerraformBestPracticesSetup.cs @@ -30,8 +30,7 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) If this tool needs to be categorized, it belongs to the Azure Best Practices category.", Title ); - var practices = serviceProvider.GetRequiredService(); - azureTerraformBestPractices.AddCommand(practices.Name, practices); + azureTerraformBestPractices.AddCommand(serviceProvider.GetRequiredService()); return azureTerraformBestPractices; } diff --git a/tools/Azure.Mcp.Tools.BicepSchema/src/BicepSchemaSetup.cs b/tools/Azure.Mcp.Tools.BicepSchema/src/BicepSchemaSetup.cs index 7a2644df1b..67485be1b1 100644 --- a/tools/Azure.Mcp.Tools.BicepSchema/src/BicepSchemaSetup.cs +++ b/tools/Azure.Mcp.Tools.BicepSchema/src/BicepSchemaSetup.cs @@ -27,9 +27,7 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) var bicepschema = new CommandGroup(Name, "Bicep schema operations - Commands for working with Azure Bicep Infrastructure as Code (IaC) generation and schema management. Includes operations for retrieving Bicep schemas, templates, and resource definitions to support infrastructure deployment automation.", Title); // Register Bicep Schema command - - var bicepSchemaGet = serviceProvider.GetRequiredService(); - bicepschema.AddCommand(bicepSchemaGet.Name, bicepSchemaGet); + bicepschema.AddCommand(serviceProvider.GetRequiredService()); return bicepschema; } diff --git a/tools/Azure.Mcp.Tools.CloudArchitect/src/CloudArchitectSetup.cs b/tools/Azure.Mcp.Tools.CloudArchitect/src/CloudArchitectSetup.cs index 1eb752b3c3..cd09cb2bf7 100644 --- a/tools/Azure.Mcp.Tools.CloudArchitect/src/CloudArchitectSetup.cs +++ b/tools/Azure.Mcp.Tools.CloudArchitect/src/CloudArchitectSetup.cs @@ -25,8 +25,7 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) var cloudArchitect = new CommandGroup(Name, "Cloud Architecture operations - Commands for generating Azure architecture designs and recommendations based on requirements.", Title); // Register CloudArchitect commands - var design = serviceProvider.GetRequiredService(); - cloudArchitect.AddCommand(design.Name, design); + cloudArchitect.AddCommand(serviceProvider.GetRequiredService()); return cloudArchitect; } diff --git a/tools/Azure.Mcp.Tools.Communication/src/CommunicationSetup.cs b/tools/Azure.Mcp.Tools.Communication/src/CommunicationSetup.cs index 276ee75400..b1162fd554 100644 --- a/tools/Azure.Mcp.Tools.Communication/src/CommunicationSetup.cs +++ b/tools/Azure.Mcp.Tools.Communication/src/CommunicationSetup.cs @@ -32,13 +32,11 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) var sms = new CommandGroup("sms", "SMS messaging operations - sending SMS messages to one or more recipients using Azure Communication Services."); communication.AddSubGroup(sms); // Register SMS commands - var smsSend = serviceProvider.GetRequiredService(); - sms.AddCommand(smsSend.Name, smsSend); + sms.AddCommand(serviceProvider.GetRequiredService()); var email = new CommandGroup("email", "Email messaging operations - sending email messages to one or more recipients using Azure Communication Services."); communication.AddSubGroup(email); - var emailSend = serviceProvider.GetRequiredService(); - email.AddCommand(emailSend.Name, emailSend); + email.AddCommand(serviceProvider.GetRequiredService()); return communication; } } diff --git a/tools/Azure.Mcp.Tools.Compute/src/ComputeSetup.cs b/tools/Azure.Mcp.Tools.Compute/src/ComputeSetup.cs index d2f118807a..fd5b651ac3 100644 --- a/tools/Azure.Mcp.Tools.Compute/src/ComputeSetup.cs +++ b/tools/Azure.Mcp.Tools.Compute/src/ComputeSetup.cs @@ -63,34 +63,20 @@ Note that this tool requires appropriate Azure RBAC permissions and will only ac compute.AddSubGroup(vm); // Register VM commands - var vmGet = serviceProvider.GetRequiredService(); - vm.AddCommand(vmGet.Name, vmGet); - - var vmCreate = serviceProvider.GetRequiredService(); - vm.AddCommand(vmCreate.Name, vmCreate); - - var vmUpdate = serviceProvider.GetRequiredService(); - vm.AddCommand(vmUpdate.Name, vmUpdate); - - var vmDelete = serviceProvider.GetRequiredService(); - vm.AddCommand(vmDelete.Name, vmDelete); + vm.AddCommand(serviceProvider.GetRequiredService()); + vm.AddCommand(serviceProvider.GetRequiredService()); + vm.AddCommand(serviceProvider.GetRequiredService()); + vm.AddCommand(serviceProvider.GetRequiredService()); // Create VMSS subgroup var vmss = new CommandGroup("vmss", "Virtual Machine Scale Set operations - Commands for managing and monitoring Azure Virtual Machine Scale Sets including scale set details, instances, and rolling upgrades."); compute.AddSubGroup(vmss); // Register VMSS commands - var vmssGet = serviceProvider.GetRequiredService(); - vmss.AddCommand(vmssGet.Name, vmssGet); - - var vmssCreate = serviceProvider.GetRequiredService(); - vmss.AddCommand(vmssCreate.Name, vmssCreate); - - var vmssUpdate = serviceProvider.GetRequiredService(); - vmss.AddCommand(vmssUpdate.Name, vmssUpdate); - - var vmssDelete = serviceProvider.GetRequiredService(); - vmss.AddCommand(vmssDelete.Name, vmssDelete); + vmss.AddCommand(serviceProvider.GetRequiredService()); + vmss.AddCommand(serviceProvider.GetRequiredService()); + vmss.AddCommand(serviceProvider.GetRequiredService()); + vmss.AddCommand(serviceProvider.GetRequiredService()); // Create Disk subgroup var disk = new CommandGroup( @@ -99,17 +85,10 @@ Note that this tool requires appropriate Azure RBAC permissions and will only ac compute.AddSubGroup(disk); // Register Disk commands - var diskCreate = serviceProvider.GetRequiredService(); - disk.AddCommand(diskCreate.Name, diskCreate); - - var diskDelete = serviceProvider.GetRequiredService(); - disk.AddCommand(diskDelete.Name, diskDelete); - - var diskGet = serviceProvider.GetRequiredService(); - disk.AddCommand(diskGet.Name, diskGet); - - var diskUpdate = serviceProvider.GetRequiredService(); - disk.AddCommand(diskUpdate.Name, diskUpdate); + disk.AddCommand(serviceProvider.GetRequiredService()); + disk.AddCommand(serviceProvider.GetRequiredService()); + disk.AddCommand(serviceProvider.GetRequiredService()); + disk.AddCommand(serviceProvider.GetRequiredService()); return compute; } diff --git a/tools/Azure.Mcp.Tools.ConfidentialLedger/src/ConfidentialLedgerSetup.cs b/tools/Azure.Mcp.Tools.ConfidentialLedger/src/ConfidentialLedgerSetup.cs index 82e612a4f5..13c475bacf 100644 --- a/tools/Azure.Mcp.Tools.ConfidentialLedger/src/ConfidentialLedgerSetup.cs +++ b/tools/Azure.Mcp.Tools.ConfidentialLedger/src/ConfidentialLedgerSetup.cs @@ -30,11 +30,8 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) var entries = new CommandGroup("entries", "Ledger entries operations - Commands for appending and retrieving ledger entries."); root.AddSubGroup(entries); - var append = serviceProvider.GetRequiredService(); - entries.AddCommand(append.Name, append); - - var get = serviceProvider.GetRequiredService(); - entries.AddCommand(get.Name, get); + entries.AddCommand(serviceProvider.GetRequiredService()); + entries.AddCommand(serviceProvider.GetRequiredService()); return root; } diff --git a/tools/Azure.Mcp.Tools.ContainerApps/src/ContainerAppsSetup.cs b/tools/Azure.Mcp.Tools.ContainerApps/src/ContainerAppsSetup.cs index 07f1a06508..870a591d7e 100644 --- a/tools/Azure.Mcp.Tools.ContainerApps/src/ContainerAppsSetup.cs +++ b/tools/Azure.Mcp.Tools.ContainerApps/src/ContainerAppsSetup.cs @@ -26,8 +26,7 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) { var containerapps = new CommandGroup(Name, "Azure Container Apps operations - Commands for managing Azure Container Apps resources. Includes operations for listing container apps and managing container app configurations.", Title); - var containerAppList = serviceProvider.GetRequiredService(); - containerapps.AddCommand(containerAppList.Name, containerAppList); + containerapps.AddCommand(serviceProvider.GetRequiredService()); return containerapps; } diff --git a/tools/Azure.Mcp.Tools.Cosmos/src/CosmosSetup.cs b/tools/Azure.Mcp.Tools.Cosmos/src/CosmosSetup.cs index 1e139eb108..e5531eeead 100644 --- a/tools/Azure.Mcp.Tools.Cosmos/src/CosmosSetup.cs +++ b/tools/Azure.Mcp.Tools.Cosmos/src/CosmosSetup.cs @@ -29,8 +29,7 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) var cosmos = new CommandGroup(Name, "Cosmos DB operations - Commands for managing and querying Azure Cosmos DB resources. Includes operations for accounts, databases, containers, and document queries.", Title); // Consolidated hierarchical list command - var cosmosList = serviceProvider.GetRequiredService(); - cosmos.AddCommand(cosmosList.Name, cosmosList); + cosmos.AddCommand(serviceProvider.GetRequiredService()); // Create Cosmos subgroups for item query var databases = new CommandGroup("database", "Cosmos DB database operations - Commands for managing databases within your Cosmos DB accounts."); @@ -43,8 +42,7 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) var cosmosItem = new CommandGroup("item", "Cosmos DB item operations - Commands for querying, creating, updating, and deleting documents within your Cosmos DB containers."); cosmosContainer.AddSubGroup(cosmosItem); - var itemQuery = serviceProvider.GetRequiredService(); - cosmosItem.AddCommand(itemQuery.Name, itemQuery); + cosmosItem.AddCommand(serviceProvider.GetRequiredService()); return cosmos; } diff --git a/tools/Azure.Mcp.Tools.Deploy/src/DeploySetup.cs b/tools/Azure.Mcp.Tools.Deploy/src/DeploySetup.cs index 413f091aba..4faf9680a7 100644 --- a/tools/Azure.Mcp.Tools.Deploy/src/DeploySetup.cs +++ b/tools/Azure.Mcp.Tools.Deploy/src/DeploySetup.cs @@ -38,38 +38,33 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) // This command will be deprecated when 'azd cli' supports the same functionality var appGroup = new CommandGroup("app", "Application-specific deployment tools"); var logsGroup = new CommandGroup("logs", "Application logs management"); - var logsGet = serviceProvider.GetRequiredService(); - logsGroup.AddCommand(logsGet.Name, logsGet); + logsGroup.AddCommand(serviceProvider.GetRequiredService()); appGroup.AddSubGroup(logsGroup); deploy.AddSubGroup(appGroup); // Infrastructure as Code commands var iacGroup = new CommandGroup("iac", "Infrastructure as Code operations"); var rulesGroup = new CommandGroup("rules", "Infrastructure as Code rules and guidelines"); - var rulesGet = serviceProvider.GetRequiredService(); - rulesGroup.AddCommand(rulesGet.Name, rulesGet); + rulesGroup.AddCommand(serviceProvider.GetRequiredService()); iacGroup.AddSubGroup(rulesGroup); deploy.AddSubGroup(iacGroup); // CI/CD Pipeline commands var pipelineGroup = new CommandGroup("pipeline", "CI/CD pipeline operations"); var guidanceGroup = new CommandGroup("guidance", "CI/CD pipeline guidance"); - var guidanceGet = serviceProvider.GetRequiredService(); - guidanceGroup.AddCommand(guidanceGet.Name, guidanceGet); + guidanceGroup.AddCommand(serviceProvider.GetRequiredService()); pipelineGroup.AddSubGroup(guidanceGroup); deploy.AddSubGroup(pipelineGroup); // Deployment planning commands var planGroup = new CommandGroup("plan", "Deployment planning operations"); - var getPlan = serviceProvider.GetRequiredService(); - planGroup.AddCommand(getPlan.Name, getPlan); + planGroup.AddCommand(serviceProvider.GetRequiredService()); deploy.AddSubGroup(planGroup); // Architecture diagram commands var architectureGroup = new CommandGroup("architecture", "Architecture diagram operations"); var diagramGroup = new CommandGroup("diagram", "Architecture diagram generation"); - var diagramGenerate = serviceProvider.GetRequiredService(); - diagramGroup.AddCommand(diagramGenerate.Name, diagramGenerate); + diagramGroup.AddCommand(serviceProvider.GetRequiredService()); architectureGroup.AddSubGroup(diagramGroup); deploy.AddSubGroup(architectureGroup); diff --git a/tools/Azure.Mcp.Tools.DeviceRegistry/src/DeviceRegistrySetup.cs b/tools/Azure.Mcp.Tools.DeviceRegistry/src/DeviceRegistrySetup.cs index 97359f2732..fd2f07f546 100644 --- a/tools/Azure.Mcp.Tools.DeviceRegistry/src/DeviceRegistrySetup.cs +++ b/tools/Azure.Mcp.Tools.DeviceRegistry/src/DeviceRegistrySetup.cs @@ -35,8 +35,7 @@ Supports listing namespaces and managing device registry resources in your Azure "Device Registry namespace operations - Commands for listing and managing Device Registry namespaces."); deviceRegistry.AddSubGroup(namespaceGroup); - var namespaceList = serviceProvider.GetRequiredService(); - namespaceGroup.AddCommand(namespaceList.Name, namespaceList); + namespaceGroup.AddCommand(serviceProvider.GetRequiredService()); return deviceRegistry; } diff --git a/tools/Azure.Mcp.Tools.EventGrid/src/EventGridSetup.cs b/tools/Azure.Mcp.Tools.EventGrid/src/EventGridSetup.cs index e86696d0d5..6e1905a5ac 100644 --- a/tools/Azure.Mcp.Tools.EventGrid/src/EventGridSetup.cs +++ b/tools/Azure.Mcp.Tools.EventGrid/src/EventGridSetup.cs @@ -43,16 +43,13 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) eventGrid.AddSubGroup(subscriptions); // Register Events commands - var eventsPublish = serviceProvider.GetRequiredService(); - events.AddCommand(eventsPublish.Name, eventsPublish); + events.AddCommand(serviceProvider.GetRequiredService()); // Register Topic commands - var topicList = serviceProvider.GetRequiredService(); - topics.AddCommand(topicList.Name, topicList); + topics.AddCommand(serviceProvider.GetRequiredService()); // Register Subscription commands - var subscriptionList = serviceProvider.GetRequiredService(); - subscriptions.AddCommand(subscriptionList.Name, subscriptionList); + subscriptions.AddCommand(serviceProvider.GetRequiredService()); return eventGrid; } diff --git a/tools/Azure.Mcp.Tools.EventHubs/src/EventHubsSetup.cs b/tools/Azure.Mcp.Tools.EventHubs/src/EventHubsSetup.cs index 73792e842b..e03cd4a7f0 100644 --- a/tools/Azure.Mcp.Tools.EventHubs/src/EventHubsSetup.cs +++ b/tools/Azure.Mcp.Tools.EventHubs/src/EventHubsSetup.cs @@ -38,38 +38,23 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) var eventHubGroup = new CommandGroup("eventhub", "Event Hub operations"); eventHubs.AddSubGroup(eventHubGroup); - var eventHubDeleteCommand = serviceProvider.GetRequiredService(); - eventHubGroup.AddCommand(eventHubDeleteCommand.Name, eventHubDeleteCommand); - - var eventHubGetCommand = serviceProvider.GetRequiredService(); - eventHubGroup.AddCommand(eventHubGetCommand.Name, eventHubGetCommand); - - var eventHubUpdateCommand = serviceProvider.GetRequiredService(); - eventHubGroup.AddCommand(eventHubUpdateCommand.Name, eventHubUpdateCommand); + eventHubGroup.AddCommand(serviceProvider.GetRequiredService()); + eventHubGroup.AddCommand(serviceProvider.GetRequiredService()); + eventHubGroup.AddCommand(serviceProvider.GetRequiredService()); var namespaceGroup = new CommandGroup("namespace", "Event Hubs namespace operations"); eventHubs.AddSubGroup(namespaceGroup); - var namespaceGetCommand = serviceProvider.GetRequiredService(); - namespaceGroup.AddCommand(namespaceGetCommand.Name, namespaceGetCommand); - - var namespaceUpdateCommand = serviceProvider.GetRequiredService(); - namespaceGroup.AddCommand(namespaceUpdateCommand.Name, namespaceUpdateCommand); - - var namespaceDeleteCommand = serviceProvider.GetRequiredService(); - namespaceGroup.AddCommand(namespaceDeleteCommand.Name, namespaceDeleteCommand); + namespaceGroup.AddCommand(serviceProvider.GetRequiredService()); + namespaceGroup.AddCommand(serviceProvider.GetRequiredService()); + namespaceGroup.AddCommand(serviceProvider.GetRequiredService()); var consumerGroupGroup = new CommandGroup("consumergroup", "Event Hubs consumer group operations"); eventHubGroup.AddSubGroup(consumerGroupGroup); - var consumerGroupDeleteCommand = serviceProvider.GetRequiredService(); - consumerGroupGroup.AddCommand(consumerGroupDeleteCommand.Name, consumerGroupDeleteCommand); - - var consumerGroupGetCommand = serviceProvider.GetRequiredService(); - consumerGroupGroup.AddCommand(consumerGroupGetCommand.Name, consumerGroupGetCommand); - - var consumerGroupUpdateCommand = serviceProvider.GetRequiredService(); - consumerGroupGroup.AddCommand(consumerGroupUpdateCommand.Name, consumerGroupUpdateCommand); + consumerGroupGroup.AddCommand(serviceProvider.GetRequiredService()); + consumerGroupGroup.AddCommand(serviceProvider.GetRequiredService()); + consumerGroupGroup.AddCommand(serviceProvider.GetRequiredService()); return eventHubs; } diff --git a/tools/Azure.Mcp.Tools.Extension/src/ExtensionSetup.cs b/tools/Azure.Mcp.Tools.Extension/src/ExtensionSetup.cs index 1135f2062a..4ce4776678 100644 --- a/tools/Azure.Mcp.Tools.Extension/src/ExtensionSetup.cs +++ b/tools/Azure.Mcp.Tools.Extension/src/ExtensionSetup.cs @@ -41,17 +41,13 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) if (exposeExternalProcessCommands) { - var azqr = serviceProvider.GetRequiredService(); - extension.AddCommand(azqr.Name, azqr); + extension.AddCommand(serviceProvider.GetRequiredService()); } var cli = new CommandGroup("cli", "Commands for helping users to use CLI tools for Azure services operations. Includes operations for generating Azure CLI commands and getting installation instructions for Azure CLI (az), Azure Developer CLI (azd), and Azure Core Function Tools CLI (func)."); extension.AddSubGroup(cli); - var cliGenerateCommand = serviceProvider.GetRequiredService(); - cli.AddCommand(cliGenerateCommand.Name, cliGenerateCommand); - - var cliInstallCommand = serviceProvider.GetRequiredService(); - cli.AddCommand(cliInstallCommand.Name, cliInstallCommand); + cli.AddCommand(serviceProvider.GetRequiredService()); + cli.AddCommand(serviceProvider.GetRequiredService()); return extension; } diff --git a/tools/Azure.Mcp.Tools.FileShares/src/FileSharesSetup.cs b/tools/Azure.Mcp.Tools.FileShares/src/FileSharesSetup.cs index eb175a9245..2b02ca8da2 100644 --- a/tools/Azure.Mcp.Tools.FileShares/src/FileSharesSetup.cs +++ b/tools/Azure.Mcp.Tools.FileShares/src/FileSharesSetup.cs @@ -48,54 +48,30 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) var fileShare = new CommandGroup("fileshare", "File share operations - Commands for managing file shares."); fileShares.AddSubGroup(fileShare); - var fileShareGet = serviceProvider.GetRequiredService(); - fileShare.AddCommand(fileShareGet.Name, fileShareGet); - - var fileShareCreate = serviceProvider.GetRequiredService(); - fileShare.AddCommand(fileShareCreate.Name, fileShareCreate); - - var fileShareUpdate = serviceProvider.GetRequiredService(); - fileShare.AddCommand(fileShareUpdate.Name, fileShareUpdate); - - var fileShareDelete = serviceProvider.GetRequiredService(); - fileShare.AddCommand(fileShareDelete.Name, fileShareDelete); - - var checkName = serviceProvider.GetRequiredService(); - fileShare.AddCommand(checkName.Name, checkName); + fileShare.AddCommand(serviceProvider.GetRequiredService()); + fileShare.AddCommand(serviceProvider.GetRequiredService()); + fileShare.AddCommand(serviceProvider.GetRequiredService()); + fileShare.AddCommand(serviceProvider.GetRequiredService()); + fileShare.AddCommand(serviceProvider.GetRequiredService()); var snapshot = new CommandGroup("snapshot", "File share snapshot operations - Commands for managing file share snapshots."); fileShare.AddSubGroup(snapshot); - var snapshotGet = serviceProvider.GetRequiredService(); - snapshot.AddCommand(snapshotGet.Name, snapshotGet); - - var snapshotCreate = serviceProvider.GetRequiredService(); - snapshot.AddCommand(snapshotCreate.Name, snapshotCreate); - - var snapshotUpdate = serviceProvider.GetRequiredService(); - snapshot.AddCommand(snapshotUpdate.Name, snapshotUpdate); - - var snapshotDelete = serviceProvider.GetRequiredService(); - snapshot.AddCommand(snapshotDelete.Name, snapshotDelete); + snapshot.AddCommand(serviceProvider.GetRequiredService()); + snapshot.AddCommand(serviceProvider.GetRequiredService()); + snapshot.AddCommand(serviceProvider.GetRequiredService()); + snapshot.AddCommand(serviceProvider.GetRequiredService()); var privateEndpoint = new CommandGroup("peconnection", "Private endpoint connection operations - Commands for managing private endpoint connections."); fileShare.AddSubGroup(privateEndpoint); - var privateEndpointGet = serviceProvider.GetRequiredService(); - privateEndpoint.AddCommand(privateEndpointGet.Name, privateEndpointGet); - - var privateEndpointUpdate = serviceProvider.GetRequiredService(); - privateEndpoint.AddCommand(privateEndpointUpdate.Name, privateEndpointUpdate); + privateEndpoint.AddCommand(serviceProvider.GetRequiredService()); + privateEndpoint.AddCommand(serviceProvider.GetRequiredService()); // Register informational commands directly under fileshares - var limits = serviceProvider.GetRequiredService(); - fileShares.AddCommand(limits.Name, limits); - - var recommendation = serviceProvider.GetRequiredService(); - fileShares.AddCommand(recommendation.Name, recommendation); - - var usage = serviceProvider.GetRequiredService(); - fileShares.AddCommand(usage.Name, usage); + fileShares.AddCommand(serviceProvider.GetRequiredService()); + fileShares.AddCommand(serviceProvider.GetRequiredService()); + fileShares.AddCommand(serviceProvider.GetRequiredService()); return fileShares; } diff --git a/tools/Azure.Mcp.Tools.FoundryExtensions/src/FoundryExtensionsSetup.cs b/tools/Azure.Mcp.Tools.FoundryExtensions/src/FoundryExtensionsSetup.cs index 3756e0b7b9..54d0c61a21 100644 --- a/tools/Azure.Mcp.Tools.FoundryExtensions/src/FoundryExtensionsSetup.cs +++ b/tools/Azure.Mcp.Tools.FoundryExtensions/src/FoundryExtensionsSetup.cs @@ -40,24 +40,21 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) var index = new CommandGroup("index", "Foundry knowledge index operations - Commands for managing knowledge indexes in Microsoft Foundry."); knowledge.AddSubGroup(index); - var indexList = serviceProvider.GetRequiredService(); - index.AddCommand(indexList.Name, indexList); - - var indexSchema = serviceProvider.GetRequiredService(); - index.AddCommand(indexSchema.Name, indexSchema); + index.AddCommand(serviceProvider.GetRequiredService()); + index.AddCommand(serviceProvider.GetRequiredService()); var openai = new CommandGroup("openai", "Foundry OpenAI operations - Commands for working with Azure OpenAI models deployed in Microsoft Foundry."); foundryExtensions.AddSubGroup(openai); - openai.AddCommand("create-completion", serviceProvider.GetRequiredService()); - openai.AddCommand("embeddings-create", serviceProvider.GetRequiredService()); - openai.AddCommand("models-list", serviceProvider.GetRequiredService()); - openai.AddCommand("chat-completions-create", serviceProvider.GetRequiredService()); + openai.AddCommand(serviceProvider.GetRequiredService()); + openai.AddCommand(serviceProvider.GetRequiredService()); + openai.AddCommand(serviceProvider.GetRequiredService()); + openai.AddCommand(serviceProvider.GetRequiredService()); var resources = new CommandGroup("resource", "Foundry resource operations - Commands for listing and managing Microsoft Foundry resources."); foundryExtensions.AddSubGroup(resources); - resources.AddCommand("get", serviceProvider.GetRequiredService()); + resources.AddCommand(serviceProvider.GetRequiredService()); return foundryExtensions; } diff --git a/tools/Azure.Mcp.Tools.FunctionApp/src/FunctionAppSetup.cs b/tools/Azure.Mcp.Tools.FunctionApp/src/FunctionAppSetup.cs index da0723fa77..f0d56d6bb8 100644 --- a/tools/Azure.Mcp.Tools.FunctionApp/src/FunctionAppSetup.cs +++ b/tools/Azure.Mcp.Tools.FunctionApp/src/FunctionAppSetup.cs @@ -26,8 +26,7 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) { var functionApp = new CommandGroup(Name, "Function App operations - Commands for managing and accessing Azure Function App resources.", Title); - var getCommand = serviceProvider.GetRequiredService(); - functionApp.AddCommand(getCommand.Name, getCommand); + functionApp.AddCommand(serviceProvider.GetRequiredService()); return functionApp; } diff --git a/tools/Azure.Mcp.Tools.Functions/src/FunctionsSetup.cs b/tools/Azure.Mcp.Tools.Functions/src/FunctionsSetup.cs index 6d23d2bbfd..a57410c46c 100644 --- a/tools/Azure.Mcp.Tools.Functions/src/FunctionsSetup.cs +++ b/tools/Azure.Mcp.Tools.Functions/src/FunctionsSetup.cs @@ -42,24 +42,21 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) "Commands for exploring Azure Functions language support and runtime versions.", "Language"); - var listCommand = serviceProvider.GetRequiredService(); - languageGroup.AddCommand(listCommand.Name, listCommand); + languageGroup.AddCommand(serviceProvider.GetRequiredService()); var projectGroup = new CommandGroup( "project", "Commands for retrieving Azure Functions project initialization templates.", "Project"); - var projectGetCommand = serviceProvider.GetRequiredService(); - projectGroup.AddCommand(projectGetCommand.Name, projectGetCommand); + projectGroup.AddCommand(serviceProvider.GetRequiredService()); var templateGroup = new CommandGroup( "template", "Commands for listing and retrieving Azure Functions function code templates.", "Template"); - var templateGetCommand = serviceProvider.GetRequiredService(); - templateGroup.AddCommand(templateGetCommand.Name, templateGetCommand); + templateGroup.AddCommand(serviceProvider.GetRequiredService()); functions.AddSubGroup(languageGroup); functions.AddSubGroup(projectGroup); diff --git a/tools/Azure.Mcp.Tools.Grafana/src/GrafanaSetup.cs b/tools/Azure.Mcp.Tools.Grafana/src/GrafanaSetup.cs index ea6f07687a..c1acf06077 100644 --- a/tools/Azure.Mcp.Tools.Grafana/src/GrafanaSetup.cs +++ b/tools/Azure.Mcp.Tools.Grafana/src/GrafanaSetup.cs @@ -26,8 +26,7 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) { var grafana = new CommandGroup(Name, "Grafana workspace operations - Commands for managing and accessing Azure Managed Grafana resources and monitoring dashboards. Includes operations for listing Grafana workspaces and managing data visualization and monitoring capabilities.", Title); - var workspace = serviceProvider.GetRequiredService(); - grafana.AddCommand(workspace.Name, workspace); + grafana.AddCommand(serviceProvider.GetRequiredService()); return grafana; } diff --git a/tools/Azure.Mcp.Tools.KeyVault/src/KeyVaultSetup.cs b/tools/Azure.Mcp.Tools.KeyVault/src/KeyVaultSetup.cs index 109be846b2..434f491a11 100644 --- a/tools/Azure.Mcp.Tools.KeyVault/src/KeyVaultSetup.cs +++ b/tools/Azure.Mcp.Tools.KeyVault/src/KeyVaultSetup.cs @@ -51,28 +51,20 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) var admin = new CommandGroup("admin", "Key Vault administration operations - Commands for administering a Managed HSM in Azure Key Vault."); keyVault.AddSubGroup(admin); - var keyGet = serviceProvider.GetRequiredService(); - keys.AddCommand(keyGet.Name, keyGet); - var keyCreate = serviceProvider.GetRequiredService(); - keys.AddCommand(keyCreate.Name, keyCreate); - - var secretCreate = serviceProvider.GetRequiredService(); - secret.AddCommand(secretCreate.Name, secretCreate); - var secretGet = serviceProvider.GetRequiredService(); - secret.AddCommand(secretGet.Name, secretGet); - - var certificateGet = serviceProvider.GetRequiredService(); - certificate.AddCommand(certificateGet.Name, certificateGet); - var certificateCreate = serviceProvider.GetRequiredService(); - certificate.AddCommand(certificateCreate.Name, certificateCreate); - var certificateImport = serviceProvider.GetRequiredService(); - certificate.AddCommand(certificateImport.Name, certificateImport); + keys.AddCommand(serviceProvider.GetRequiredService()); + keys.AddCommand(serviceProvider.GetRequiredService()); + + secret.AddCommand(serviceProvider.GetRequiredService()); + secret.AddCommand(serviceProvider.GetRequiredService()); + + certificate.AddCommand(serviceProvider.GetRequiredService()); + certificate.AddCommand(serviceProvider.GetRequiredService()); + certificate.AddCommand(serviceProvider.GetRequiredService()); var settings = new CommandGroup("settings", "Key Vault Managed HSM account settings operations - Commands for managing Key Vault Managed HSM account settings."); admin.AddSubGroup(settings); - var adminSettingsGet = serviceProvider.GetRequiredService(); - settings.AddCommand(adminSettingsGet.Name, adminSettingsGet); + settings.AddCommand(serviceProvider.GetRequiredService()); return keyVault; } diff --git a/tools/Azure.Mcp.Tools.Kusto/src/KustoSetup.cs b/tools/Azure.Mcp.Tools.Kusto/src/KustoSetup.cs index 274a45695b..7741ecfa86 100644 --- a/tools/Azure.Mcp.Tools.Kusto/src/KustoSetup.cs +++ b/tools/Azure.Mcp.Tools.Kusto/src/KustoSetup.cs @@ -46,23 +46,16 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) var tables = new CommandGroup("table", "Kusto table operations - Commands for listing tables in a database."); kusto.AddSubGroup(tables); - var sampleCommand = serviceProvider.GetRequiredService(); - kusto.AddCommand(sampleCommand.Name, sampleCommand); - var queryCommand = serviceProvider.GetRequiredService(); - kusto.AddCommand(queryCommand.Name, queryCommand); - - var clusterList = serviceProvider.GetRequiredService(); - clusters.AddCommand(clusterList.Name, clusterList); - var clusterGet = serviceProvider.GetRequiredService(); - clusters.AddCommand(clusterGet.Name, clusterGet); - - var databaseList = serviceProvider.GetRequiredService(); - databases.AddCommand(databaseList.Name, databaseList); - - var tableList = serviceProvider.GetRequiredService(); - tables.AddCommand(tableList.Name, tableList); - var tableSchema = serviceProvider.GetRequiredService(); - tables.AddCommand(tableSchema.Name, tableSchema); + kusto.AddCommand(serviceProvider.GetRequiredService()); + kusto.AddCommand(serviceProvider.GetRequiredService()); + + clusters.AddCommand(serviceProvider.GetRequiredService()); + clusters.AddCommand(serviceProvider.GetRequiredService()); + + databases.AddCommand(serviceProvider.GetRequiredService()); + + tables.AddCommand(serviceProvider.GetRequiredService()); + tables.AddCommand(serviceProvider.GetRequiredService()); return kusto; } diff --git a/tools/Azure.Mcp.Tools.LoadTesting/src/LoadTestingSetup.cs b/tools/Azure.Mcp.Tools.LoadTesting/src/LoadTestingSetup.cs index d0143c50a5..398a4a4f0d 100644 --- a/tools/Azure.Mcp.Tools.LoadTesting/src/LoadTestingSetup.cs +++ b/tools/Azure.Mcp.Tools.LoadTesting/src/LoadTestingSetup.cs @@ -57,23 +57,16 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) service.AddSubGroup(testRun); // Register commands for Load Test Resource - - var testResourceList = serviceProvider.GetRequiredService(); - testResource.AddCommand(testResourceList.Name, testResourceList); - var testResourceCreate = serviceProvider.GetRequiredService(); - testResource.AddCommand(testResourceCreate.Name, testResourceCreate); + testResource.AddCommand(serviceProvider.GetRequiredService()); + testResource.AddCommand(serviceProvider.GetRequiredService()); // Register commands for Load Test - var testGet = serviceProvider.GetRequiredService(); - test.AddCommand(testGet.Name, testGet); - var testCreate = serviceProvider.GetRequiredService(); - test.AddCommand(testCreate.Name, testCreate); + test.AddCommand(serviceProvider.GetRequiredService()); + test.AddCommand(serviceProvider.GetRequiredService()); // Register commands for Load Test Run - var testRunGet = serviceProvider.GetRequiredService(); - testRun.AddCommand(testRunGet.Name, testRunGet); - var testRunUpdate = serviceProvider.GetRequiredService(); - testRun.AddCommand(testRunUpdate.Name, testRunUpdate); + testRun.AddCommand(serviceProvider.GetRequiredService()); + testRun.AddCommand(serviceProvider.GetRequiredService()); return service; } diff --git a/tools/Azure.Mcp.Tools.ManagedLustre/src/ManagedLustreSetup.cs b/tools/Azure.Mcp.Tools.ManagedLustre/src/ManagedLustreSetup.cs index a94d269073..0a9f5c8649 100644 --- a/tools/Azure.Mcp.Tools.ManagedLustre/src/ManagedLustreSetup.cs +++ b/tools/Azure.Mcp.Tools.ManagedLustre/src/ManagedLustreSetup.cs @@ -50,74 +50,44 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) var fileSystem = new CommandGroup("fs", "Azure Managed Lustre file system operations - Commands for listing managed Lustre file systems."); managedLustre.AddSubGroup(fileSystem); - var list = serviceProvider.GetRequiredService(); - fileSystem.AddCommand(list.Name, list); - - var create = serviceProvider.GetRequiredService(); - fileSystem.AddCommand(create.Name, create); - - var update = serviceProvider.GetRequiredService(); - fileSystem.AddCommand(update.Name, update); + fileSystem.AddCommand(serviceProvider.GetRequiredService()); + fileSystem.AddCommand(serviceProvider.GetRequiredService()); + fileSystem.AddCommand(serviceProvider.GetRequiredService()); var subnetSize = new CommandGroup("subnetsize", "Subnet size planning and validation operations for Azure Managed Lustre."); fileSystem.AddSubGroup(subnetSize); - var subnetSizeAsk = serviceProvider.GetRequiredService(); - subnetSize.AddCommand(subnetSizeAsk.Name, subnetSizeAsk); - - var subnetSizeValidate = serviceProvider.GetRequiredService(); - subnetSize.AddCommand(subnetSizeValidate.Name, subnetSizeValidate); + subnetSize.AddCommand(serviceProvider.GetRequiredService()); + subnetSize.AddCommand(serviceProvider.GetRequiredService()); var sku = new CommandGroup("sku", "This group provides commands to discover and retrieve information about available Azure Managed Lustre SKUs, including supported tiers, performance characteristics, and regional availability. Use these commands to validate SKU options prior to provisioning or updating a filesystem."); fileSystem.AddSubGroup(sku); - var skuGet = serviceProvider.GetRequiredService(); - sku.AddCommand(skuGet.Name, skuGet); + sku.AddCommand(serviceProvider.GetRequiredService()); var autoexportJob = new CommandGroup("blob_autoexport", "Autoexport job operations for Azure Managed Lustre - Commands for creating jobs to export data from the filesystem to blob storage."); fileSystem.AddSubGroup(autoexportJob); - var autoexportJobCreate = serviceProvider.GetRequiredService(); - autoexportJob.AddCommand(autoexportJobCreate.Name, autoexportJobCreate); - - var autoexportJobCancel = serviceProvider.GetRequiredService(); - autoexportJob.AddCommand(autoexportJobCancel.Name, autoexportJobCancel); - - var autoexportJobGet = serviceProvider.GetRequiredService(); - autoexportJob.AddCommand(autoexportJobGet.Name, autoexportJobGet); - - var autoexportJobDelete = serviceProvider.GetRequiredService(); - autoexportJob.AddCommand(autoexportJobDelete.Name, autoexportJobDelete); + autoexportJob.AddCommand(serviceProvider.GetRequiredService()); + autoexportJob.AddCommand(serviceProvider.GetRequiredService()); + autoexportJob.AddCommand(serviceProvider.GetRequiredService()); + autoexportJob.AddCommand(serviceProvider.GetRequiredService()); var autoimportJob = new CommandGroup("blob_autoimport", "Autoimport job operations for Azure Managed Lustre - Commands for creating jobs to import data from blob storage to the filesystem."); fileSystem.AddSubGroup(autoimportJob); - var autoimportJobCreate = serviceProvider.GetRequiredService(); - autoimportJob.AddCommand(autoimportJobCreate.Name, autoimportJobCreate); - - var autoimportJobCancel = serviceProvider.GetRequiredService(); - autoimportJob.AddCommand(autoimportJobCancel.Name, autoimportJobCancel); - - var autoimportJobGet = serviceProvider.GetRequiredService(); - autoimportJob.AddCommand(autoimportJobGet.Name, autoimportJobGet); - - var autoimportJobDelete = serviceProvider.GetRequiredService(); - autoimportJob.AddCommand(autoimportJobDelete.Name, autoimportJobDelete); + autoimportJob.AddCommand(serviceProvider.GetRequiredService()); + autoimportJob.AddCommand(serviceProvider.GetRequiredService()); + autoimportJob.AddCommand(serviceProvider.GetRequiredService()); + autoimportJob.AddCommand(serviceProvider.GetRequiredService()); var blobImport = new CommandGroup("blob_import", "One-time blob import operations for Azure Managed Lustre - Commands for creating jobs to perform one-time import of data from blob storage to the filesystem."); fileSystem.AddSubGroup(blobImport); - var importJobCreate = serviceProvider.GetRequiredService(); - blobImport.AddCommand(importJobCreate.Name, importJobCreate); - - var importJobCancel = serviceProvider.GetRequiredService(); - blobImport.AddCommand(importJobCancel.Name, importJobCancel); - - var importJobGet = serviceProvider.GetRequiredService(); - blobImport.AddCommand(importJobGet.Name, importJobGet); - - var importJobDelete = serviceProvider.GetRequiredService(); - blobImport.AddCommand(importJobDelete.Name, importJobDelete); + blobImport.AddCommand(serviceProvider.GetRequiredService()); + blobImport.AddCommand(serviceProvider.GetRequiredService()); + blobImport.AddCommand(serviceProvider.GetRequiredService()); + blobImport.AddCommand(serviceProvider.GetRequiredService()); return managedLustre; } diff --git a/tools/Azure.Mcp.Tools.Marketplace/src/MarketplaceSetup.cs b/tools/Azure.Mcp.Tools.Marketplace/src/MarketplaceSetup.cs index 28b5cb259e..be80a2d87a 100644 --- a/tools/Azure.Mcp.Tools.Marketplace/src/MarketplaceSetup.cs +++ b/tools/Azure.Mcp.Tools.Marketplace/src/MarketplaceSetup.cs @@ -33,10 +33,8 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) marketplace.AddSubGroup(product); // Register Product commands - var productGet = serviceProvider.GetRequiredService(); - product.AddCommand(productGet.Name, productGet); - var productList = serviceProvider.GetRequiredService(); - product.AddCommand(productList.Name, productList); + product.AddCommand(serviceProvider.GetRequiredService()); + product.AddCommand(serviceProvider.GetRequiredService()); return marketplace; } diff --git a/tools/Azure.Mcp.Tools.Monitor/src/MonitorSetup.cs b/tools/Azure.Mcp.Tools.Monitor/src/MonitorSetup.cs index 2ff6bb3323..733d367dc4 100644 --- a/tools/Azure.Mcp.Tools.Monitor/src/MonitorSetup.cs +++ b/tools/Azure.Mcp.Tools.Monitor/src/MonitorSetup.cs @@ -121,19 +121,13 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) resources.AddSubGroup(resourceLogs); // Register Monitor commands + workspaceLogs.AddCommand(serviceProvider.GetRequiredService()); + workspaceLogs.AddCommand(serviceProvider.GetRequiredService()); - var workspaceLogQuery = serviceProvider.GetRequiredService(); - workspaceLogs.AddCommand(workspaceLogQuery.Name, workspaceLogQuery); - var resourceLogQuery = serviceProvider.GetRequiredService(); - resourceLogs.AddCommand(resourceLogQuery.Name, resourceLogQuery); + workspaces.AddCommand(serviceProvider.GetRequiredService()); + workspaces.AddCommand(serviceProvider.GetRequiredService()); - var workspaceList = serviceProvider.GetRequiredService(); - workspaces.AddCommand(workspaceList.Name, workspaceList); - var tableList = serviceProvider.GetRequiredService(); - monitorTable.AddCommand(tableList.Name, tableList); - - var tableTypeList = serviceProvider.GetRequiredService(); - monitorTableType.AddCommand(tableTypeList.Name, tableTypeList); + monitorTableType.AddCommand(serviceProvider.GetRequiredService()); var health = new CommandGroup("healthmodels", "Azure Monitor Health Models operations - Commands for working with Azure Monitor Health Models."); monitor.AddSubGroup(health); @@ -141,46 +135,35 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) var entity = new CommandGroup("entity", "Entity operations - Commands for working with entities in Azure Monitor Health Models."); health.AddSubGroup(entity); - var entityGetHealth = serviceProvider.GetRequiredService(); - entity.AddCommand(entityGetHealth.Name, entityGetHealth); + entity.AddCommand(serviceProvider.GetRequiredService()); // Create Metrics command group and register commands var metrics = new CommandGroup("metrics", "Azure Monitor metrics operations - Commands for querying and analyzing Azure Monitor metrics."); monitor.AddSubGroup(metrics); - var metricsQuery = serviceProvider.GetRequiredService(); - metrics.AddCommand(metricsQuery.Name, metricsQuery); - var metricsDefinitions = serviceProvider.GetRequiredService(); - metrics.AddCommand(metricsDefinitions.Name, metricsDefinitions); + metrics.AddCommand(serviceProvider.GetRequiredService()); + metrics.AddCommand(serviceProvider.GetRequiredService()); var activityLog = new CommandGroup("activitylog", "Azure Monitor activity log operations - Commands for querying and analyzing activity logs for Azure resources."); monitor.AddSubGroup(activityLog); - var activityLogList = serviceProvider.GetRequiredService(); - activityLog.AddCommand(activityLogList.Name, activityLogList); + activityLog.AddCommand(serviceProvider.GetRequiredService()); // Register Monitor.WebTest sub-group commands var webTests = new CommandGroup("webtests", "Azure Monitor Web Test operations - Commands for working with Azure Availability/Web Tests."); monitor.AddSubGroup(webTests); - var webTestGet = serviceProvider.GetRequiredService(); - webTests.AddCommand(webTestGet.Name, webTestGet); - var webTestCreateOrUpdate = serviceProvider.GetRequiredService(); - webTests.AddCommand(webTestCreateOrUpdate.Name, webTestCreateOrUpdate); + webTests.AddCommand(serviceProvider.GetRequiredService()); + webTests.AddCommand(serviceProvider.GetRequiredService()); var instrumentation = new CommandGroup("instrumentation", "Azure Monitor instrumentation operations - Commands for orchestrated onboarding and migration steps."); monitor.AddSubGroup(instrumentation); - var getLearningResource = serviceProvider.GetRequiredService(); - instrumentation.AddCommand(getLearningResource.Name, getLearningResource); - var orchestratorStart = serviceProvider.GetRequiredService(); - instrumentation.AddCommand(orchestratorStart.Name, orchestratorStart); - var orchestratorNext = serviceProvider.GetRequiredService(); - instrumentation.AddCommand(orchestratorNext.Name, orchestratorNext); - var sendBrownfieldAnalysis = serviceProvider.GetRequiredService(); - instrumentation.AddCommand(sendBrownfieldAnalysis.Name, sendBrownfieldAnalysis); - var sendEnhancementSelect = serviceProvider.GetRequiredService(); - instrumentation.AddCommand(sendEnhancementSelect.Name, sendEnhancementSelect); + instrumentation.AddCommand(serviceProvider.GetRequiredService()); + instrumentation.AddCommand(serviceProvider.GetRequiredService()); + instrumentation.AddCommand(serviceProvider.GetRequiredService()); + instrumentation.AddCommand(serviceProvider.GetRequiredService()); + instrumentation.AddCommand(serviceProvider.GetRequiredService()); return monitor; } diff --git a/tools/Azure.Mcp.Tools.MySql/src/MySqlSetup.cs b/tools/Azure.Mcp.Tools.MySql/src/MySqlSetup.cs index ecdf1a5ea2..96455e2a26 100644 --- a/tools/Azure.Mcp.Tools.MySql/src/MySqlSetup.cs +++ b/tools/Azure.Mcp.Tools.MySql/src/MySqlSetup.cs @@ -35,38 +35,32 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) var mysql = new CommandGroup(Name, "MySQL operations - Commands for managing Azure Database for MySQL Flexible Server resources. Includes operations for listing servers and databases, executing SQL queries, managing table schemas, and configuring server parameters.", Title); // Consolidated hierarchical list command - var mysqlList = serviceProvider.GetRequiredService(); - mysql.AddCommand(mysqlList.Name, mysqlList); + mysql.AddCommand(serviceProvider.GetRequiredService()); var database = new CommandGroup("database", "MySQL database operations"); mysql.AddSubGroup(database); - var databaseQuery = serviceProvider.GetRequiredService(); - database.AddCommand(databaseQuery.Name, databaseQuery); + database.AddCommand(serviceProvider.GetRequiredService()); var table = new CommandGroup("table", "MySQL table operations"); mysql.AddSubGroup(table); var schema = new CommandGroup("schema", "MySQL table schema operations"); table.AddSubGroup(schema); - var tableSchemaGet = serviceProvider.GetRequiredService(); - schema.AddCommand(tableSchemaGet.Name, tableSchemaGet); + schema.AddCommand(serviceProvider.GetRequiredService()); var server = new CommandGroup("server", "MySQL server operations"); mysql.AddSubGroup(server); var config = new CommandGroup("config", "MySQL server configuration operations"); server.AddSubGroup(config); - var serverConfig = serviceProvider.GetRequiredService(); - config.AddCommand(serverConfig.Name, serverConfig); + config.AddCommand(serviceProvider.GetRequiredService()); var param = new CommandGroup("param", "MySQL server parameter operations"); server.AddSubGroup(param); - var serverParamGet = serviceProvider.GetRequiredService(); - param.AddCommand(serverParamGet.Name, serverParamGet); - var serverParamSet = serviceProvider.GetRequiredService(); - param.AddCommand(serverParamSet.Name, serverParamSet); + param.AddCommand(serviceProvider.GetRequiredService()); + param.AddCommand(serviceProvider.GetRequiredService()); return mysql; } diff --git a/tools/Azure.Mcp.Tools.Policy/src/PolicySetup.cs b/tools/Azure.Mcp.Tools.Policy/src/PolicySetup.cs index 1087d549cf..fdc796a3fd 100644 --- a/tools/Azure.Mcp.Tools.Policy/src/PolicySetup.cs +++ b/tools/Azure.Mcp.Tools.Policy/src/PolicySetup.cs @@ -35,8 +35,7 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) policy.AddSubGroup(assignment); // Register assignment commands - var listCommand = serviceProvider.GetRequiredService(); - assignment.AddCommand(listCommand.Name, listCommand); + assignment.AddCommand(serviceProvider.GetRequiredService()); return policy; } diff --git a/tools/Azure.Mcp.Tools.Postgres/src/PostgresSetup.cs b/tools/Azure.Mcp.Tools.Postgres/src/PostgresSetup.cs index 9704cb6fe6..c553ffe652 100644 --- a/tools/Azure.Mcp.Tools.Postgres/src/PostgresSetup.cs +++ b/tools/Azure.Mcp.Tools.Postgres/src/PostgresSetup.cs @@ -39,37 +39,31 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) var pg = new CommandGroup(Name, "PostgreSQL operations - Commands for managing Azure Database for PostgreSQL Flexible Server resources. Includes operations for listing servers and databases, executing SQL queries, managing table schemas, and configuring server parameters.", Title); // Consolidated hierarchical list command - var postgresList = serviceProvider.GetRequiredService(); - pg.AddCommand(postgresList.Name, postgresList); + pg.AddCommand(serviceProvider.GetRequiredService()); var database = new CommandGroup("database", "PostgreSQL database operations"); pg.AddSubGroup(database); - var databaseQuery = serviceProvider.GetRequiredService(); - database.AddCommand(databaseQuery.Name, databaseQuery); + database.AddCommand(serviceProvider.GetRequiredService()); var table = new CommandGroup("table", "PostgreSQL table operations"); pg.AddSubGroup(table); var schema = new CommandGroup("schema", "PostgreSQL table schema operations"); table.AddSubGroup(schema); - var tableSchemaGet = serviceProvider.GetRequiredService(); - schema.AddCommand(tableSchemaGet.Name, tableSchemaGet); + schema.AddCommand(serviceProvider.GetRequiredService()); var server = new CommandGroup("server", "PostgreSQL server operations"); pg.AddSubGroup(server); var config = new CommandGroup("config", "PostgreSQL server configuration operations"); server.AddSubGroup(config); - var serverConfigGet = serviceProvider.GetRequiredService(); - config.AddCommand(serverConfigGet.Name, serverConfigGet); + config.AddCommand(serviceProvider.GetRequiredService()); var param = new CommandGroup("param", "PostgreSQL server parameter operations"); server.AddSubGroup(param); - var serverParamGet = serviceProvider.GetRequiredService(); - param.AddCommand(serverParamGet.Name, serverParamGet); - var serverParamSet = serviceProvider.GetRequiredService(); - param.AddCommand(serverParamSet.Name, serverParamSet); + param.AddCommand(serviceProvider.GetRequiredService()); + param.AddCommand(serviceProvider.GetRequiredService()); return pg; } diff --git a/tools/Azure.Mcp.Tools.Pricing/src/PricingSetup.cs b/tools/Azure.Mcp.Tools.Pricing/src/PricingSetup.cs index 14dd004c98..863772f854 100644 --- a/tools/Azure.Mcp.Tools.Pricing/src/PricingSetup.cs +++ b/tools/Azure.Mcp.Tools.Pricing/src/PricingSetup.cs @@ -32,8 +32,7 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) "For Bicep/ARM template cost estimation, read the template file, extract resource SKUs, then call 'pricing get' for each resource to build a cost estimate.", Title); - var getCommand = serviceProvider.GetRequiredService(); - pricing.AddCommand(getCommand.Name, getCommand); + pricing.AddCommand(serviceProvider.GetRequiredService()); return pricing; } diff --git a/tools/Azure.Mcp.Tools.Quota/src/QuotaSetup.cs b/tools/Azure.Mcp.Tools.Quota/src/QuotaSetup.cs index 909244481a..dfcd3e3b67 100644 --- a/tools/Azure.Mcp.Tools.Quota/src/QuotaSetup.cs +++ b/tools/Azure.Mcp.Tools.Quota/src/QuotaSetup.cs @@ -29,15 +29,13 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) + " or checking Azure resource quota and usage", Title); var usageGroup = new CommandGroup("usage", "Resource usage and quota operations"); - var checkCommand = serviceProvider.GetRequiredService(); - usageGroup.AddCommand(checkCommand.Name, checkCommand); + usageGroup.AddCommand(serviceProvider.GetRequiredService()); quota.AddSubGroup(usageGroup); var regionGroup = new CommandGroup("region", "Region availability operations"); var availabilityGroup = new CommandGroup("availability", "Region availability information"); - var availabilityListCommand = serviceProvider.GetRequiredService(); - availabilityGroup.AddCommand(availabilityListCommand.Name, availabilityListCommand); + availabilityGroup.AddCommand(serviceProvider.GetRequiredService()); regionGroup.AddSubGroup(availabilityGroup); quota.AddSubGroup(regionGroup); diff --git a/tools/Azure.Mcp.Tools.Redis/src/RedisSetup.cs b/tools/Azure.Mcp.Tools.Redis/src/RedisSetup.cs index 6d1d4debe9..5829a2b83a 100644 --- a/tools/Azure.Mcp.Tools.Redis/src/RedisSetup.cs +++ b/tools/Azure.Mcp.Tools.Redis/src/RedisSetup.cs @@ -27,11 +27,8 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) { var redis = new CommandGroup(Name, "Redis operations - Commands for managing Azure Redis resources. Includes operations for listing Redis resources, databases, and data access policies, in both the Azure Managed Redis and legacy Azure Cache for Redis services, as well as for creating Azure Managed Redis resources.", Title); - var redisResourceList = serviceProvider.GetRequiredService(); - redis.AddCommand(redisResourceList.Name, redisResourceList); - - var redisResourceCreate = serviceProvider.GetRequiredService(); - redis.AddCommand(redisResourceCreate.Name, redisResourceCreate); + redis.AddCommand(serviceProvider.GetRequiredService()); + redis.AddCommand(serviceProvider.GetRequiredService()); return redis; } diff --git a/tools/Azure.Mcp.Tools.ResourceHealth/src/ResourceHealthSetup.cs b/tools/Azure.Mcp.Tools.ResourceHealth/src/ResourceHealthSetup.cs index c376a131e5..2b7e5c3077 100644 --- a/tools/Azure.Mcp.Tools.ResourceHealth/src/ResourceHealthSetup.cs +++ b/tools/Azure.Mcp.Tools.ResourceHealth/src/ResourceHealthSetup.cs @@ -28,7 +28,7 @@ public void ConfigureServices(IServiceCollection services) public CommandGroup RegisterCommands(IServiceProvider serviceProvider) { var resourceHealth = new CommandGroup(Name, - "Resource Health operations – Commands to monitor and diagnose Azure resource health, including availability status and service health events for troubleshooting and monitoring purposes.", Title); + "Resource Health operations - Commands to monitor and diagnose Azure resource health, including availability status and service health events for troubleshooting and monitoring purposes.", Title); // Create availability-status subgroup var availabilityStatus = new CommandGroup("availability-status", @@ -41,11 +41,8 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) resourceHealth.AddSubGroup(serviceHealthEvents); // Register commands - var availabilityStatusCmd = serviceProvider.GetRequiredService(); - availabilityStatus.AddCommand(availabilityStatusCmd.Name, availabilityStatusCmd); - - var serviceHealthEventsList = serviceProvider.GetRequiredService(); - serviceHealthEvents.AddCommand(serviceHealthEventsList.Name, serviceHealthEventsList); + availabilityStatus.AddCommand(serviceProvider.GetRequiredService()); + serviceHealthEvents.AddCommand(serviceProvider.GetRequiredService()); return resourceHealth; } diff --git a/tools/Azure.Mcp.Tools.Search/src/SearchSetup.cs b/tools/Azure.Mcp.Tools.Search/src/SearchSetup.cs index 9610309035..ef71bed96f 100644 --- a/tools/Azure.Mcp.Tools.Search/src/SearchSetup.cs +++ b/tools/Azure.Mcp.Tools.Search/src/SearchSetup.cs @@ -43,16 +43,13 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) var service = new CommandGroup("service", "Azure AI Search (formerly known as \"Azure Cognitive Search\") service operations - Commands for listing and managing search services in your Azure subscription."); search.AddSubGroup(service); - var serviceList = serviceProvider.GetRequiredService(); - service.AddCommand(serviceList.Name, serviceList); + service.AddCommand(serviceProvider.GetRequiredService()); var index = new CommandGroup("index", "Azure AI Search (formerly known as \"Azure Cognitive Search\") index operations - Commands for listing, managing, and querying search indexes in a specific search service."); search.AddSubGroup(index); - var indexGet = serviceProvider.GetRequiredService(); - index.AddCommand(indexGet.Name, indexGet); - var indexQuery = serviceProvider.GetRequiredService(); - index.AddCommand(indexQuery.Name, indexQuery); + index.AddCommand(serviceProvider.GetRequiredService()); + index.AddCommand(serviceProvider.GetRequiredService()); var knowledge = new CommandGroup("knowledge", "Azure AI Search knowledge operations - Commands retrieving data from knowledge sources, listing knowledge sources and knowledge bases in a search service."); search.AddSubGroup(knowledge); @@ -60,16 +57,13 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) var knowledgeSource = new CommandGroup("source", "Knowledge source operations - get knowledge sources associated with a service."); knowledge.AddSubGroup(knowledgeSource); - var knowledgeSourceGet = serviceProvider.GetRequiredService(); - knowledgeSource.AddCommand(knowledgeSourceGet.Name, knowledgeSourceGet); + knowledgeSource.AddCommand(serviceProvider.GetRequiredService()); var knowledgeBase = new CommandGroup("base", "Knowledge base operations - get knowledge bases associated with a service."); knowledge.AddSubGroup(knowledgeBase); - var knowledgeBaseGet = serviceProvider.GetRequiredService(); - knowledgeBase.AddCommand(knowledgeBaseGet.Name, knowledgeBaseGet); - var knowledgeBaseRetrieve = serviceProvider.GetRequiredService(); - knowledgeBase.AddCommand(knowledgeBaseRetrieve.Name, knowledgeBaseRetrieve); + knowledgeBase.AddCommand(serviceProvider.GetRequiredService()); + knowledgeBase.AddCommand(serviceProvider.GetRequiredService()); return search; } diff --git a/tools/Azure.Mcp.Tools.ServiceBus/src/ServiceBusSetup.cs b/tools/Azure.Mcp.Tools.ServiceBus/src/ServiceBusSetup.cs index 0c719889f3..befca18da7 100644 --- a/tools/Azure.Mcp.Tools.ServiceBus/src/ServiceBusSetup.cs +++ b/tools/Azure.Mcp.Tools.ServiceBus/src/ServiceBusSetup.cs @@ -27,21 +27,18 @@ public void ConfigureServices(IServiceCollection services) public CommandGroup RegisterCommands(IServiceProvider serviceProvider) { - var serviceBus = new CommandGroup(Name, "Service Bus operations – Commands to manage Azure Service Bus queues, topics, and subscriptions for reliable asynchronous messaging and enterprise integration. Supports point-to-point and publish-subscribe patterns, dead-letter handling, and decoupled architectures. Not intended for real-time communication, direct API calls, or database operations. Uses a hierarchical MCP command model with command, parameters, and learn=true.", Title); + var serviceBus = new CommandGroup(Name, "Service Bus operations - Commands to manage Azure Service Bus queues, topics, and subscriptions for reliable asynchronous messaging and enterprise integration. Supports point-to-point and publish-subscribe patterns, dead-letter handling, and decoupled architectures. Not intended for real-time communication, direct API calls, or database operations. Uses a hierarchical MCP command model with command, parameters, and learn=true.", Title); var queue = new CommandGroup("queue", "Queue operations - Commands for using Azure Service Bus queues."); // queue.AddCommand("peek", new QueuePeekCommand()); - var queueDetails = serviceProvider.GetRequiredService(); - queue.AddCommand(queueDetails.Name, queueDetails); + queue.AddCommand(serviceProvider.GetRequiredService()); var topic = new CommandGroup("topic", "Topic operations - Commands for using Azure Service Bus topics and subscriptions."); - var topicDetails = serviceProvider.GetRequiredService(); - topic.AddCommand(topicDetails.Name, topicDetails); + topic.AddCommand(serviceProvider.GetRequiredService()); var subscription = new CommandGroup("subscription", "Subscription operations - Commands for using subscriptions within a Service Bus topic."); // subscription.AddCommand("peek", new SubscriptionPeekCommand()); - var subscriptionDetails = serviceProvider.GetRequiredService(); - subscription.AddCommand(subscriptionDetails.Name, subscriptionDetails); + subscription.AddCommand(serviceProvider.GetRequiredService()); serviceBus.AddSubGroup(queue); serviceBus.AddSubGroup(topic); diff --git a/tools/Azure.Mcp.Tools.ServiceFabric/src/ServiceFabricSetup.cs b/tools/Azure.Mcp.Tools.ServiceFabric/src/ServiceFabricSetup.cs index d66dc67019..ef3d33ee97 100644 --- a/tools/Azure.Mcp.Tools.ServiceFabric/src/ServiceFabricSetup.cs +++ b/tools/Azure.Mcp.Tools.ServiceFabric/src/ServiceFabricSetup.cs @@ -39,16 +39,14 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) "Node operations - Commands for getting and querying nodes in a Service Fabric managed cluster."); managedCluster.AddSubGroup(node); - var nodeGet = serviceProvider.GetRequiredService(); - node.AddCommand(nodeGet.Name, nodeGet); + node.AddCommand(serviceProvider.GetRequiredService()); var nodetype = new CommandGroup( "nodetype", "Node type operations - Commands for managing node types in a Service Fabric managed cluster."); managedCluster.AddSubGroup(nodetype); - var nodeTypeRestart = serviceProvider.GetRequiredService(); - nodetype.AddCommand(nodeTypeRestart.Name, nodeTypeRestart); + nodetype.AddCommand(serviceProvider.GetRequiredService()); return serviceFabric; } diff --git a/tools/Azure.Mcp.Tools.SignalR/src/SignalRSetup.cs b/tools/Azure.Mcp.Tools.SignalR/src/SignalRSetup.cs index b8cd810fc2..2030cfded8 100644 --- a/tools/Azure.Mcp.Tools.SignalR/src/SignalRSetup.cs +++ b/tools/Azure.Mcp.Tools.SignalR/src/SignalRSetup.cs @@ -31,8 +31,7 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) "Runtime operations - Commands for managing Azure SignalR Service resources."); signalr.AddSubGroup(runtime); - var runtimeGet = serviceProvider.GetRequiredService(); - runtime.AddCommand(runtimeGet.Name, runtimeGet); + runtime.AddCommand(serviceProvider.GetRequiredService()); return signalr; } diff --git a/tools/Azure.Mcp.Tools.Speech/src/SpeechSetup.cs b/tools/Azure.Mcp.Tools.Speech/src/SpeechSetup.cs index 32f9dde8a2..f750f446db 100644 --- a/tools/Azure.Mcp.Tools.Speech/src/SpeechSetup.cs +++ b/tools/Azure.Mcp.Tools.Speech/src/SpeechSetup.cs @@ -49,8 +49,7 @@ and output options. name: "stt", description: "Speech-to-text operations - Commands for converting spoken audio to text using Azure AI Services Speech recognition."); - var sttRecognize = serviceProvider.GetRequiredService(); - stt.AddCommand(sttRecognize.Name, sttRecognize); + stt.AddCommand(serviceProvider.GetRequiredService()); speech.AddSubGroup(stt); @@ -58,8 +57,7 @@ and output options. name: "tts", description: "Text-to-speech operations - Commands for converting text to spoken audio using Azure AI Services Speech synthesis."); - var ttsSynthesize = serviceProvider.GetRequiredService(); - tts.AddCommand(ttsSynthesize.Name, ttsSynthesize); + tts.AddCommand(serviceProvider.GetRequiredService()); speech.AddSubGroup(tts); diff --git a/tools/Azure.Mcp.Tools.Sql/src/SqlSetup.cs b/tools/Azure.Mcp.Tools.Sql/src/SqlSetup.cs index 81080ad95a..3cbca3be80 100644 --- a/tools/Azure.Mcp.Tools.Sql/src/SqlSetup.cs +++ b/tools/Azure.Mcp.Tools.Sql/src/SqlSetup.cs @@ -49,47 +49,34 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) var database = new CommandGroup("db", "SQL database operations"); sql.AddSubGroup(database); - var databaseGet = serviceProvider.GetRequiredService(); - database.AddCommand(databaseGet.Name, databaseGet); - var databaseCreate = serviceProvider.GetRequiredService(); - database.AddCommand(databaseCreate.Name, databaseCreate); - var databaseRename = serviceProvider.GetRequiredService(); - database.AddCommand(databaseRename.Name, databaseRename); - var databaseUpdate = serviceProvider.GetRequiredService(); - database.AddCommand(databaseUpdate.Name, databaseUpdate); - var databaseDelete = serviceProvider.GetRequiredService(); - database.AddCommand(databaseDelete.Name, databaseDelete); + database.AddCommand(serviceProvider.GetRequiredService()); + database.AddCommand(serviceProvider.GetRequiredService()); + database.AddCommand(serviceProvider.GetRequiredService()); + database.AddCommand(serviceProvider.GetRequiredService()); + database.AddCommand(serviceProvider.GetRequiredService()); var server = new CommandGroup("server", "SQL server operations"); sql.AddSubGroup(server); - var serverGet = serviceProvider.GetRequiredService(); - server.AddCommand(serverGet.Name, serverGet); - var serverCreate = serviceProvider.GetRequiredService(); - server.AddCommand(serverCreate.Name, serverCreate); - var serverDelete = serviceProvider.GetRequiredService(); - server.AddCommand(serverDelete.Name, serverDelete); + server.AddCommand(serviceProvider.GetRequiredService()); + server.AddCommand(serviceProvider.GetRequiredService()); + server.AddCommand(serviceProvider.GetRequiredService()); var elasticPool = new CommandGroup("elastic-pool", "SQL elastic pool operations"); sql.AddSubGroup(elasticPool); - var elasticPoolList = serviceProvider.GetRequiredService(); - elasticPool.AddCommand(elasticPoolList.Name, elasticPoolList); + elasticPool.AddCommand(serviceProvider.GetRequiredService()); var entraAdmin = new CommandGroup("entra-admin", "SQL server Microsoft Entra ID administrator operations"); server.AddSubGroup(entraAdmin); - var entraAdminList = serviceProvider.GetRequiredService(); - entraAdmin.AddCommand(entraAdminList.Name, entraAdminList); + entraAdmin.AddCommand(serviceProvider.GetRequiredService()); var firewallRule = new CommandGroup("firewall-rule", "SQL server firewall rule operations"); server.AddSubGroup(firewallRule); - var firewallRuleList = serviceProvider.GetRequiredService(); - firewallRule.AddCommand(firewallRuleList.Name, firewallRuleList); - var firewallRuleCreate = serviceProvider.GetRequiredService(); - firewallRule.AddCommand(firewallRuleCreate.Name, firewallRuleCreate); - var firewallRuleDelete = serviceProvider.GetRequiredService(); - firewallRule.AddCommand(firewallRuleDelete.Name, firewallRuleDelete); + firewallRule.AddCommand(serviceProvider.GetRequiredService()); + firewallRule.AddCommand(serviceProvider.GetRequiredService()); + firewallRule.AddCommand(serviceProvider.GetRequiredService()); return sql; } diff --git a/tools/Azure.Mcp.Tools.Storage/src/StorageSetup.cs b/tools/Azure.Mcp.Tools.Storage/src/StorageSetup.cs index 2f4a85c9a3..911811d5ca 100644 --- a/tools/Azure.Mcp.Tools.Storage/src/StorageSetup.cs +++ b/tools/Azure.Mcp.Tools.Storage/src/StorageSetup.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +using System.Reflection.Metadata; using Azure.Mcp.Tools.Storage.Commands.Account; using Azure.Mcp.Tools.Storage.Commands.Blob; using Azure.Mcp.Tools.Storage.Commands.Blob.Container; @@ -59,27 +60,20 @@ account details (SKU, location, HNS, HTTPS-only settings), create and list blob blobs.AddSubGroup(blobContainer); // Register Storage commands - var accountCreate = serviceProvider.GetRequiredService(); - storageAccount.AddCommand(accountCreate.Name, accountCreate); - var accountGet = serviceProvider.GetRequiredService(); - storageAccount.AddCommand(accountGet.Name, accountGet); + storageAccount.AddCommand(serviceProvider.GetRequiredService()); + storageAccount.AddCommand(serviceProvider.GetRequiredService()); - var blobGet = serviceProvider.GetRequiredService(); - blobs.AddCommand(blobGet.Name, blobGet); - var blobUpload = serviceProvider.GetRequiredService(); - blobs.AddCommand(blobUpload.Name, blobUpload); + blobs.AddCommand(serviceProvider.GetRequiredService()); + blobs.AddCommand(serviceProvider.GetRequiredService()); - var containerCreate = serviceProvider.GetRequiredService(); - blobContainer.AddCommand(containerCreate.Name, containerCreate); - var containerGet = serviceProvider.GetRequiredService(); - blobContainer.AddCommand(containerGet.Name, containerGet); + blobContainer.AddCommand(serviceProvider.GetRequiredService()); + blobContainer.AddCommand(serviceProvider.GetRequiredService()); // Create Table subgroup under storage var tables = new CommandGroup("table", "Storage table operations - Commands for managing tables in your Azure Storage accounts."); storage.AddSubGroup(tables); - var tableList = serviceProvider.GetRequiredService(); - tables.AddCommand(tableList.Name, tableList); + tables.AddCommand(serviceProvider.GetRequiredService()); return storage; } diff --git a/tools/Azure.Mcp.Tools.StorageSync/src/StorageSyncSetup.cs b/tools/Azure.Mcp.Tools.StorageSync/src/StorageSyncSetup.cs index 4eaa403951..61bf0a1816 100644 --- a/tools/Azure.Mcp.Tools.StorageSync/src/StorageSyncSetup.cs +++ b/tools/Azure.Mcp.Tools.StorageSync/src/StorageSyncSetup.cs @@ -82,48 +82,48 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) "Storage Sync Service operations - Create, get, update, and delete Storage Sync services in your Azure subscription."); storageSync.AddSubGroup(storageSyncServiceGroup); - storageSyncServiceGroup.AddCommand("get", serviceProvider.GetRequiredService()); - storageSyncServiceGroup.AddCommand("create", serviceProvider.GetRequiredService()); - storageSyncServiceGroup.AddCommand("update", serviceProvider.GetRequiredService()); - storageSyncServiceGroup.AddCommand("delete", serviceProvider.GetRequiredService()); + storageSyncServiceGroup.AddCommand(serviceProvider.GetRequiredService()); + storageSyncServiceGroup.AddCommand(serviceProvider.GetRequiredService()); + storageSyncServiceGroup.AddCommand(serviceProvider.GetRequiredService()); + storageSyncServiceGroup.AddCommand(serviceProvider.GetRequiredService()); // RegisteredServer subgroup var registeredServerGroup = new CommandGroup("registeredserver", "Registered Server operations - Get, update, and unregister servers in your Storage Sync service."); storageSync.AddSubGroup(registeredServerGroup); - registeredServerGroup.AddCommand("get", serviceProvider.GetRequiredService()); - registeredServerGroup.AddCommand("update", serviceProvider.GetRequiredService()); - registeredServerGroup.AddCommand("unregister", serviceProvider.GetRequiredService()); + registeredServerGroup.AddCommand(serviceProvider.GetRequiredService()); + registeredServerGroup.AddCommand(serviceProvider.GetRequiredService()); + registeredServerGroup.AddCommand(serviceProvider.GetRequiredService()); // SyncGroup subgroup var syncGroupGroup = new CommandGroup("syncgroup", "Sync Group operations - Create, get, and delete sync groups in your Storage Sync service."); storageSync.AddSubGroup(syncGroupGroup); - syncGroupGroup.AddCommand("get", serviceProvider.GetRequiredService()); - syncGroupGroup.AddCommand("create", serviceProvider.GetRequiredService()); - syncGroupGroup.AddCommand("delete", serviceProvider.GetRequiredService()); + syncGroupGroup.AddCommand(serviceProvider.GetRequiredService()); + syncGroupGroup.AddCommand(serviceProvider.GetRequiredService()); + syncGroupGroup.AddCommand(serviceProvider.GetRequiredService()); // CloudEndpoint subgroup var cloudEndpointGroup = new CommandGroup("cloudendpoint", "Cloud Endpoint operations - Create, get, delete, and manage cloud endpoints in your sync groups."); storageSync.AddSubGroup(cloudEndpointGroup); - cloudEndpointGroup.AddCommand("get", serviceProvider.GetRequiredService()); - cloudEndpointGroup.AddCommand("create", serviceProvider.GetRequiredService()); - cloudEndpointGroup.AddCommand("delete", serviceProvider.GetRequiredService()); - cloudEndpointGroup.AddCommand("changedetection", serviceProvider.GetRequiredService()); + cloudEndpointGroup.AddCommand(serviceProvider.GetRequiredService()); + cloudEndpointGroup.AddCommand(serviceProvider.GetRequiredService()); + cloudEndpointGroup.AddCommand(serviceProvider.GetRequiredService()); + cloudEndpointGroup.AddCommand(serviceProvider.GetRequiredService()); // ServerEndpoint subgroup var serverEndpointGroup = new CommandGroup("serverendpoint", "Server Endpoint operations - Create, get, update, and delete server endpoints in your sync groups."); storageSync.AddSubGroup(serverEndpointGroup); - serverEndpointGroup.AddCommand("get", serviceProvider.GetRequiredService()); - serverEndpointGroup.AddCommand("create", serviceProvider.GetRequiredService()); - serverEndpointGroup.AddCommand("update", serviceProvider.GetRequiredService()); - serverEndpointGroup.AddCommand("delete", serviceProvider.GetRequiredService()); + serverEndpointGroup.AddCommand(serviceProvider.GetRequiredService()); + serverEndpointGroup.AddCommand(serviceProvider.GetRequiredService()); + serverEndpointGroup.AddCommand(serviceProvider.GetRequiredService()); + serverEndpointGroup.AddCommand(serviceProvider.GetRequiredService()); return storageSync; } diff --git a/tools/Azure.Mcp.Tools.VirtualDesktop/src/VirtualDesktopSetup.cs b/tools/Azure.Mcp.Tools.VirtualDesktop/src/VirtualDesktopSetup.cs index a55e9c8c6e..ef2f05979d 100644 --- a/tools/Azure.Mcp.Tools.VirtualDesktop/src/VirtualDesktopSetup.cs +++ b/tools/Azure.Mcp.Tools.VirtualDesktop/src/VirtualDesktopSetup.cs @@ -37,12 +37,9 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) hostpool.AddSubGroup(sessionhost); // Register AVD commands - var hostpoolList = serviceProvider.GetRequiredService(); - hostpool.AddCommand(hostpoolList.Name, hostpoolList); - var sessionHostList = serviceProvider.GetRequiredService(); - sessionhost.AddCommand(sessionHostList.Name, sessionHostList); - var sessionHostUserSessionList = serviceProvider.GetRequiredService(); - sessionhost.AddCommand(sessionHostUserSessionList.Name, sessionHostUserSessionList); + hostpool.AddCommand(serviceProvider.GetRequiredService()); + sessionhost.AddCommand(serviceProvider.GetRequiredService()); + sessionhost.AddCommand(serviceProvider.GetRequiredService()); return desktop; } diff --git a/tools/Azure.Mcp.Tools.WellArchitectedFramework/src/WellArchitectedFrameworkSetup.cs b/tools/Azure.Mcp.Tools.WellArchitectedFramework/src/WellArchitectedFrameworkSetup.cs index 6f9cd7468f..aea99dc59d 100644 --- a/tools/Azure.Mcp.Tools.WellArchitectedFramework/src/WellArchitectedFrameworkSetup.cs +++ b/tools/Azure.Mcp.Tools.WellArchitectedFramework/src/WellArchitectedFrameworkSetup.cs @@ -29,8 +29,7 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) var serviceGuide = new CommandGroup("serviceguide", "Service guide operations - Commands for retrieving Azure Well-Architected Framework service-specific guidance and recommendations."); wellArchitectedCommandGroup.AddSubGroup(serviceGuide); - var serviceGuideGet = serviceProvider.GetRequiredService(); - serviceGuide.AddCommand(serviceGuideGet.Name, serviceGuideGet); + serviceGuide.AddCommand(serviceProvider.GetRequiredService()); return wellArchitectedCommandGroup; } diff --git a/tools/Azure.Mcp.Tools.Workbooks/src/WorkbooksSetup.cs b/tools/Azure.Mcp.Tools.Workbooks/src/WorkbooksSetup.cs index 75d0c3cbc6..af4a32c99a 100644 --- a/tools/Azure.Mcp.Tools.Workbooks/src/WorkbooksSetup.cs +++ b/tools/Azure.Mcp.Tools.Workbooks/src/WorkbooksSetup.cs @@ -30,20 +30,11 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) { var workbooks = new CommandGroup(Name, "Workbooks operations - Commands for managing Azure Workbooks resources and interactive data visualization dashboards. Includes operations for listing, creating, updating, and deleting workbooks, as well as managing workbook configurations and content.", Title); - var workbooksList = serviceProvider.GetRequiredService(); - workbooks.AddCommand(workbooksList.Name, workbooksList); - - var workbooksShow = serviceProvider.GetRequiredService(); - workbooks.AddCommand(workbooksShow.Name, workbooksShow); - - var workbooksUpdate = serviceProvider.GetRequiredService(); - workbooks.AddCommand(workbooksUpdate.Name, workbooksUpdate); - - var workbooksCreate = serviceProvider.GetRequiredService(); - workbooks.AddCommand(workbooksCreate.Name, workbooksCreate); - - var workbooksDelete = serviceProvider.GetRequiredService(); - workbooks.AddCommand(workbooksDelete.Name, workbooksDelete); + workbooks.AddCommand(serviceProvider.GetRequiredService()); + workbooks.AddCommand(serviceProvider.GetRequiredService()); + workbooks.AddCommand(serviceProvider.GetRequiredService()); + workbooks.AddCommand(serviceProvider.GetRequiredService()); + workbooks.AddCommand(serviceProvider.GetRequiredService()); return workbooks; } diff --git a/tools/Fabric.Mcp.Tools.Core/src/FabricCoreSetup.cs b/tools/Fabric.Mcp.Tools.Core/src/FabricCoreSetup.cs index 493c37bf5e..b45ffe90cd 100644 --- a/tools/Fabric.Mcp.Tools.Core/src/FabricCoreSetup.cs +++ b/tools/Fabric.Mcp.Tools.Core/src/FabricCoreSetup.cs @@ -31,8 +31,7 @@ Microsoft Fabric Core Operations - Create and manage Fabric items. This tool provides core operations for working with Fabric resources. """); - var createItem = serviceProvider.GetRequiredService(); - fabricCore.AddCommand(createItem.Name, createItem); + fabricCore.AddCommand(serviceProvider.GetRequiredService()); return fabricCore; } diff --git a/tools/Fabric.Mcp.Tools.Docs/src/FabricDocsSetup.cs b/tools/Fabric.Mcp.Tools.Docs/src/FabricDocsSetup.cs index f381c2f976..f42483ae75 100644 --- a/tools/Fabric.Mcp.Tools.Docs/src/FabricDocsSetup.cs +++ b/tools/Fabric.Mcp.Tools.Docs/src/FabricDocsSetup.cs @@ -45,23 +45,12 @@ interact with live Fabric resources or require authentication. """, Title); // Register all commands directly at the docs level (flat structure) - var listWorkloads = serviceProvider.GetRequiredService(); - fabricDocs.AddCommand(listWorkloads.Name, listWorkloads); - - var getApiSpec = serviceProvider.GetRequiredService(); - fabricDocs.AddCommand(getApiSpec.Name, getApiSpec); - - var getPlatformApiSpec = serviceProvider.GetRequiredService(); - fabricDocs.AddCommand(getPlatformApiSpec.Name, getPlatformApiSpec); - - var getItemDefinition = serviceProvider.GetRequiredService(); - fabricDocs.AddCommand(getItemDefinition.Name, getItemDefinition); - - var getBestPractices = serviceProvider.GetRequiredService(); - fabricDocs.AddCommand(getBestPractices.Name, getBestPractices); - - var getExamples = serviceProvider.GetRequiredService(); - fabricDocs.AddCommand(getExamples.Name, getExamples); + fabricDocs.AddCommand(serviceProvider.GetRequiredService()); + fabricDocs.AddCommand(serviceProvider.GetRequiredService()); + fabricDocs.AddCommand(serviceProvider.GetRequiredService()); + fabricDocs.AddCommand(serviceProvider.GetRequiredService()); + fabricDocs.AddCommand(serviceProvider.GetRequiredService()); + fabricDocs.AddCommand(serviceProvider.GetRequiredService()); return fabricDocs; } diff --git a/tools/Fabric.Mcp.Tools.OneLake/src/FabricOneLakeSetup.cs b/tools/Fabric.Mcp.Tools.OneLake/src/FabricOneLakeSetup.cs index b6688f3749..1d0bac9926 100644 --- a/tools/Fabric.Mcp.Tools.OneLake/src/FabricOneLakeSetup.cs +++ b/tools/Fabric.Mcp.Tools.OneLake/src/FabricOneLakeSetup.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using Fabric.Mcp.Tools.OneLake.Commands; using Fabric.Mcp.Tools.OneLake.Commands.File; using Fabric.Mcp.Tools.OneLake.Commands.Item; using Fabric.Mcp.Tools.OneLake.Commands.Table; @@ -69,47 +68,20 @@ Microsoft Fabric OneLake Operations - Manage and interact with OneLake data lake """); // Register all commands at the onelake level (flat structure with verb_object naming) - var listWorkspaces = serviceProvider.GetRequiredService(); - fabricOneLake.AddCommand(listWorkspaces.Name, listWorkspaces); - - var listItems = serviceProvider.GetRequiredService(); - fabricOneLake.AddCommand(listItems.Name, listItems); - - var listItemsDfs = serviceProvider.GetRequiredService(); - fabricOneLake.AddCommand(listItemsDfs.Name, listItemsDfs); - - var listFiles = serviceProvider.GetRequiredService(); - fabricOneLake.AddCommand(listFiles.Name, listFiles); - - var downloadFile = serviceProvider.GetRequiredService(); - fabricOneLake.AddCommand(downloadFile.Name, downloadFile); - - var uploadFile = serviceProvider.GetRequiredService(); - fabricOneLake.AddCommand(uploadFile.Name, uploadFile); - - var deleteFile = serviceProvider.GetRequiredService(); - fabricOneLake.AddCommand(deleteFile.Name, deleteFile); - - var createDirectory = serviceProvider.GetRequiredService(); - fabricOneLake.AddCommand(createDirectory.Name, createDirectory); - - var deleteDirectory = serviceProvider.GetRequiredService(); - fabricOneLake.AddCommand(deleteDirectory.Name, deleteDirectory); - - var getTableConfig = serviceProvider.GetRequiredService(); - fabricOneLake.AddCommand(getTableConfig.Name, getTableConfig); - - var listTableNamespaces = serviceProvider.GetRequiredService(); - fabricOneLake.AddCommand(listTableNamespaces.Name, listTableNamespaces); - - var getTableNamespace = serviceProvider.GetRequiredService(); - fabricOneLake.AddCommand(getTableNamespace.Name, getTableNamespace); - - var listTables = serviceProvider.GetRequiredService(); - fabricOneLake.AddCommand(listTables.Name, listTables); - - var getTable = serviceProvider.GetRequiredService(); - fabricOneLake.AddCommand(getTable.Name, getTable); + fabricOneLake.AddCommand(serviceProvider.GetRequiredService()); + fabricOneLake.AddCommand(serviceProvider.GetRequiredService()); + fabricOneLake.AddCommand(serviceProvider.GetRequiredService()); + fabricOneLake.AddCommand(serviceProvider.GetRequiredService()); + fabricOneLake.AddCommand(serviceProvider.GetRequiredService()); + fabricOneLake.AddCommand(serviceProvider.GetRequiredService()); + fabricOneLake.AddCommand(serviceProvider.GetRequiredService()); + fabricOneLake.AddCommand(serviceProvider.GetRequiredService()); + fabricOneLake.AddCommand(serviceProvider.GetRequiredService()); + fabricOneLake.AddCommand(serviceProvider.GetRequiredService()); + fabricOneLake.AddCommand(serviceProvider.GetRequiredService()); + fabricOneLake.AddCommand(serviceProvider.GetRequiredService()); + fabricOneLake.AddCommand(serviceProvider.GetRequiredService()); + fabricOneLake.AddCommand(serviceProvider.GetRequiredService()); return fabricOneLake; }