Skip to content
This repository was archived by the owner on Sep 4, 2025. It is now read-only.

Commit 890dcda

Browse files
authored
Standardize Storage descriptions and option and parameter names (#1015)
* Standardize Storage descriptions and option and parameter names * Fix serialization * Fix tests * Add CHANGELOG entries
1 parent 70d61f3 commit 890dcda

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+503
-516
lines changed

‎CHANGELOG.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ The Azure MCP Server updates automatically by default whenever a new release com
1010

1111
### Breaking Changes
1212

13+
- Renamed the following Storage tool option names: [[#1015](https://github.com/Azure/azure-mcp/pull/1015)]
14+
- Renamed `azmcp-storage-account-create` `account-name` to `account`.
15+
- Renamed `azmcp-storage-blob-batch-set-tier` `blob-names` to `blobs`.
16+
1317
### Bugs Fixed
1418

1519
- Fixed SQL service test assertions to use case-insensitive string comparisons for resource type validation. [[#938](https://github.com/Azure/azure-mcp/pull/938)]
@@ -21,6 +25,7 @@ The Azure MCP Server updates automatically by default whenever a new release com
2125
- Removed dependency on `Azure.ResourceManager.Sql` package by migrating to Azure Resource Graph queries, reducing package size and improving startup performance.
2226
- Enhanced `BaseAzureService` with `EscapeKqlString` method for safe KQL query construction across all Azure services. [[#938](https://github.com/Azure/azure-mcp/pull/938)]
2327
- Fixed KQL string escaping in Workbooks service queries.
28+
- Standardized Azure Storage command descriptions, option names, and parameter names for consistency across all storage commands. Updated JSON serialization context to remove unused model types and improve organization. [[#1015](https://github.com/Azure/azure-mcp/pull/1015)]
2429

2530
## 0.5.7 (2025-08-19)
2631

‎areas/storage/src/AzureMcp.Storage/Commands/Account/AccountCreateCommand.cs‎

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using AzureMcp.Core.Commands;
55
using AzureMcp.Core.Commands.Subscription;
6-
using AzureMcp.Core.Services.Telemetry;
76
using AzureMcp.Storage.Models;
87
using AzureMcp.Storage.Options;
98
using AzureMcp.Storage.Options.Account;
@@ -18,7 +17,7 @@ public sealed class AccountCreateCommand(ILogger<AccountCreateCommand> logger) :
1817
private readonly ILogger<AccountCreateCommand> _logger = logger;
1918

2019
// Define options from OptionDefinitions
21-
private readonly Option<string> _accountNameOption = StorageOptionDefinitions.AccountNameForCreate;
20+
private readonly Option<string> _accountCreateOption = StorageOptionDefinitions.AccountCreate;
2221
private readonly Option<string> _locationOption = StorageOptionDefinitions.Location;
2322
private readonly Option<string> _skuOption = StorageOptionDefinitions.Sku;
2423
private readonly Option<string> _kindOption = StorageOptionDefinitions.Kind;
@@ -34,17 +33,6 @@ public sealed class AccountCreateCommand(ILogger<AccountCreateCommand> logger) :
3433
Create a new Azure Storage account in the specified resource group and location.
3534
Creates a storage account with the specified configuration options. Returns the
3635
created storage account information including name, location, SKU, and other properties.
37-
Required options:
38-
- account-name: The globally unique name for the storage account
39-
- resource-group: The resource group where the account will be created
40-
- location: The Azure region for the storage account
41-
Optional options:
42-
- sku: Storage account SKU (default: Standard_LRS)
43-
- kind: Storage account kind (default: StorageV2)
44-
- access-tier: Default access tier for blobs (default: Hot)
45-
- enable-https-traffic-only: Require HTTPS (default: true)
46-
- allow-blob-public-access: Allow public blob access (default: false)
47-
- enable-hierarchical-namespace: Enable Data Lake Storage Gen2 (default: false)
4836
""";
4937

5038
public override string Title => CommandTitle;
@@ -58,7 +46,7 @@ Creates a storage account with the specified configuration options. Returns the
5846
protected override void RegisterOptions(Command command)
5947
{
6048
base.RegisterOptions(command);
61-
command.AddOption(_accountNameOption);
49+
command.AddOption(_accountCreateOption);
6250
RequireResourceGroup();
6351
command.AddOption(_locationOption);
6452
command.AddOption(_skuOption);
@@ -72,7 +60,7 @@ protected override void RegisterOptions(Command command)
7260
protected override AccountCreateOptions BindOptions(ParseResult parseResult)
7361
{
7462
var options = base.BindOptions(parseResult);
75-
options.AccountName = parseResult.GetValueForOption(_accountNameOption);
63+
options.Account = parseResult.GetValueForOption(_accountCreateOption);
7664
options.Location = parseResult.GetValueForOption(_locationOption);
7765
options.Sku = parseResult.GetValueForOption(_skuOption);
7866
options.Kind = parseResult.GetValueForOption(_kindOption);
@@ -100,7 +88,7 @@ public override async Task<CommandResponse> ExecuteAsync(CommandContext context,
10088

10189
// Call service to create storage account
10290
var account = await storageService.CreateStorageAccount(
103-
options.AccountName!,
91+
options.Account!,
10492
options.ResourceGroup!,
10593
options.Location!,
10694
options.Subscription!,
@@ -122,8 +110,8 @@ public override async Task<CommandResponse> ExecuteAsync(CommandContext context,
122110
{
123111
// Log error with all relevant context
124112
_logger.LogError(ex,
125-
"Error creating storage account. Account: {AccountName}, ResourceGroup: {ResourceGroup}, Location: {Location}, Options: {@Options}",
126-
options.AccountName, options.ResourceGroup, options.Location, options);
113+
"Error creating storage account. Account: {Account}, ResourceGroup: {ResourceGroup}, Location: {Location}, Options: {@Options}",
114+
options.Account, options.ResourceGroup, options.Location, options);
127115
HandleException(context, ex);
128116
}
129117

‎areas/storage/src/AzureMcp.Storage/Commands/Account/AccountDetailsCommand.cs‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
using System.Text.Json.Serialization;
54
using AzureMcp.Core.Commands;
6-
using AzureMcp.Core.Commands.Subscription;
7-
using AzureMcp.Core.Models.Option;
8-
using AzureMcp.Core.Services.Telemetry;
9-
using AzureMcp.Storage.Commands;
10-
using AzureMcp.Storage.Options;
115
using AzureMcp.Storage.Options.Account;
126
using AzureMcp.Storage.Services;
137
using Microsoft.Extensions.Logging;
@@ -89,5 +83,5 @@ public override async Task<CommandResponse> ExecuteAsync(CommandContext context,
8983
};
9084

9185
// Strongly-typed result record
92-
internal record AccountDetailsCommandResult(Storage.Models.StorageAccountInfo Account);
86+
internal record AccountDetailsCommandResult(Models.StorageAccountInfo Account);
9387
}

‎areas/storage/src/AzureMcp.Storage/Commands/Account/AccountListCommand.cs‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
using AzureMcp.Core.Commands;
55
using AzureMcp.Core.Commands.Subscription;
6-
using AzureMcp.Core.Models.Option;
7-
using AzureMcp.Core.Services.Telemetry;
86
using AzureMcp.Storage.Options.Account;
97
using AzureMcp.Storage.Services;
108
using Microsoft.Extensions.Logging;
@@ -21,9 +19,8 @@ public sealed class AccountListCommand(ILogger<AccountListCommand> logger) : Sub
2119
public override string Description =>
2220
$"""
2321
List all Storage accounts in a subscription. This command retrieves all Storage accounts available
24-
in the specified {OptionDefinitions.Common.SubscriptionName}. Results are returned as a JSON array of
25-
objects including common metadata (name, location, kind, skuName, skuTier, hnsEnabled, allowBlobPublicAccess,
26-
enableHttpsTrafficOnly).
22+
in the specified subscription. Results are returned as a JSON array of objects including common
23+
metadata (name, location, kind, skuName, skuTier, hnsEnabled, allowBlobPublicAccess, enableHttpsTrafficOnly).
2724
""";
2825

2926
public override string Title => CommandTitle;
@@ -48,7 +45,7 @@ public override async Task<CommandResponse> ExecuteAsync(CommandContext context,
4845
options.RetryPolicy);
4946

5047
context.Response.Results = accounts?.Count > 0
51-
? ResponseResult.Create<AccountListCommandResult>(new AccountListCommandResult(accounts), StorageJsonContext.Default.AccountListCommandResult)
48+
? ResponseResult.Create(new AccountListCommandResult(accounts), StorageJsonContext.Default.AccountListCommandResult)
5249
: null;
5350
}
5451
catch (Exception ex)
@@ -60,5 +57,5 @@ public override async Task<CommandResponse> ExecuteAsync(CommandContext context,
6057
return context.Response;
6158
}
6259

63-
internal record AccountListCommandResult(List<Storage.Models.StorageAccountInfo> Accounts);
60+
internal record AccountListCommandResult(List<Models.StorageAccountInfo> Accounts);
6461
}

‎areas/storage/src/AzureMcp.Storage/Commands/Blob/Batch/BatchSetTierCommand.cs‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the MIT License.
33

44
using AzureMcp.Core.Commands;
5-
using AzureMcp.Core.Services.Telemetry;
65
using AzureMcp.Storage.Commands.Blob.Container;
76
using AzureMcp.Storage.Options;
87
using AzureMcp.Storage.Options.Blob.Batch;
@@ -17,16 +16,15 @@ public sealed class BatchSetTierCommand(ILogger<BatchSetTierCommand> logger) : B
1716
private readonly ILogger<BatchSetTierCommand> _logger = logger;
1817

1918
private readonly Option<string> _tierOption = StorageOptionDefinitions.Tier;
20-
private readonly Option<string[]> _blobNamesOption = StorageOptionDefinitions.BlobNames;
19+
private readonly Option<string[]> _blobsOption = StorageOptionDefinitions.Blobs;
2120

2221
public override string Name => "set-tier";
2322

2423
public override string Description =>
2524
$"""
2625
Set access tier for multiple blobs in a single batch operation. This tool efficiently changes the
2726
storage tier for multiple blobs simultaneously in a single request. Different tiers offer different
28-
trade-offs between storage costs, access costs, and retrieval latency. Requires {StorageOptionDefinitions.AccountName},
29-
{StorageOptionDefinitions.ContainerName}, {StorageOptionDefinitions.TierName}, and {StorageOptionDefinitions.BlobNames}.
27+
trade-offs between storage costs, access costs, and retrieval latency.
3028
""";
3129

3230
public override string Title => CommandTitle;
@@ -37,14 +35,14 @@ protected override void RegisterOptions(Command command)
3735
{
3836
base.RegisterOptions(command);
3937
command.AddOption(_tierOption);
40-
command.AddOption(_blobNamesOption);
38+
command.AddOption(_blobsOption);
4139
}
4240

4341
protected override BatchSetTierOptions BindOptions(ParseResult parseResult)
4442
{
4543
var options = base.BindOptions(parseResult);
4644
options.Tier = parseResult.GetValueForOption(_tierOption);
47-
options.BlobNames = parseResult.GetValueForOption(_blobNamesOption);
45+
options.BlobNames = parseResult.GetValueForOption(_blobsOption);
4846
return options;
4947
}
5048

‎areas/storage/src/AzureMcp.Storage/Commands/Blob/BlobDetailsCommand.cs‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using Azure.Storage.Blobs.Models;
55
using AzureMcp.Core.Commands;
6-
using AzureMcp.Core.Services.Telemetry;
76
using AzureMcp.Storage.Options;
87
using AzureMcp.Storage.Options.Blob;
98
using AzureMcp.Storage.Services;
@@ -21,8 +20,7 @@ public sealed class BlobDetailsCommand(ILogger<BlobDetailsCommand> logger) : Bas
2120
public override string Description =>
2221
$"""
2322
Get blob properties, metadata, and general information. This tool retrieves blob configuration including metadata properties,
24-
approximate size, and last modification time information. Returns blob properties as JSON. Requires {StorageOptionDefinitions.AccountName},
25-
{StorageOptionDefinitions.ContainerName}, and {StorageOptionDefinitions.BlobName}.
23+
approximate size, and last modification time information. Returns blob properties as JSON.
2624
""";
2725

2826
public override string Title => CommandTitle;

‎areas/storage/src/AzureMcp.Storage/Commands/Blob/BlobListCommand.cs‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
// Licensed under the MIT License.
33

44
using AzureMcp.Core.Commands;
5-
using AzureMcp.Core.Services.Telemetry;
65
using AzureMcp.Storage.Commands.Blob.Container;
7-
using AzureMcp.Storage.Options;
86
using AzureMcp.Storage.Options.Blob;
97
using AzureMcp.Storage.Services;
108
using Microsoft.Extensions.Logging;
@@ -22,8 +20,7 @@ public sealed class BlobListCommand(ILogger<BlobListCommand> logger) : BaseConta
2220
$"""
2321
List all blobs in a Storage container. This command retrieves and displays all blobs available
2422
in the specified container and Storage account. Results include blob names, sizes, and content types,
25-
returned as a JSON array. Requires {StorageOptionDefinitions.AccountName} and
26-
{StorageOptionDefinitions.ContainerName}.
23+
returned as a JSON array.
2724
""";
2825

2926
public override string Title => CommandTitle;

‎areas/storage/src/AzureMcp.Storage/Commands/Blob/Container/ContainerCreateCommand.cs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using Azure.Storage.Blobs.Models;
55
using AzureMcp.Core.Commands;
6-
using AzureMcp.Core.Services.Telemetry;
76
using AzureMcp.Storage.Options;
87
using AzureMcp.Storage.Options.Blob.Container;
98
using AzureMcp.Storage.Services;

‎areas/storage/src/AzureMcp.Storage/Commands/Blob/Container/ContainerDetailsCommand.cs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System.Text.Json.Serialization;
55
using Azure.Storage.Blobs.Models;
66
using AzureMcp.Core.Commands;
7-
using AzureMcp.Core.Services.Telemetry;
87
using AzureMcp.Storage.Options;
98
using AzureMcp.Storage.Options.Blob.Container;
109
using AzureMcp.Storage.Services;
@@ -22,7 +21,6 @@ public sealed class ContainerDetailsCommand(ILogger<ContainerDetailsCommand> log
2221
public override string Description =>
2322
$"""
2423
Get detailed properties of a storage container including metadata, lease status, and access level.
25-
Requires {StorageOptionDefinitions.AccountName} and {StorageOptionDefinitions.ContainerName}.
2624
""";
2725

2826
public override string Title => CommandTitle;

‎areas/storage/src/AzureMcp.Storage/Commands/Blob/Container/ContainerListCommand.cs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the MIT License.
33

44
using AzureMcp.Core.Commands;
5-
using AzureMcp.Core.Services.Telemetry;
65
using AzureMcp.Storage.Options;
76
using AzureMcp.Storage.Options.Blob.Container;
87
using AzureMcp.Storage.Services;
@@ -21,7 +20,6 @@ public sealed class ContainerListCommand(ILogger<ContainerListCommand> logger) :
2120
$"""
2221
List all containers in a Storage account. This command retrieves and displays all containers available
2322
in the specified account. Results include container names and are returned as a JSON array.
24-
Requires {StorageOptionDefinitions.AccountName}.
2523
""";
2624

2725
public override string Title => CommandTitle;

0 commit comments

Comments
 (0)