azure_list_storage_accounts
List all Azure Storage Accounts to manage cloud storage resources, retrieve account details, and monitor storage configurations across subscriptions.
Instructions
List all Storage Accounts in Azure
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| subscriptionId | No | Azure subscription ID | |
| location | No | Azure location/region | eastus |
Implementation Reference
- src/tools/azure-tools.ts:68-81 (handler)The switch case handler for 'azure_list_storage_accounts' that calls the adapter to list accounts and formats the response with total and mapped account details.case 'azure_list_storage_accounts': { const accounts = await adapter.listStorageAccounts(); return { total: accounts.length, storageAccounts: accounts.map((account) => ({ id: account.id, name: account.accountName, resourceGroup: account.resourceGroup, location: account.location, kind: account.kind, sku: account.sku, })), }; }
- src/tools/azure-tools.ts:23-40 (schema)Tool definition including name, description, and input schema for subscriptionId (required) and location (optional, default 'eastus').{ name: 'azure_list_storage_accounts', description: 'List all Storage Accounts in Azure', inputSchema: { type: 'object', properties: { subscriptionId: { type: 'string', description: 'Azure subscription ID', }, location: { type: 'string', description: 'Azure location/region', default: 'eastus', }, }, }, },
- Implements the core logic to list Azure storage accounts using StorageManagementClient, populating details like ID, name, resource group, location, kind, SKU, etc.async listStorageAccounts(): Promise<AzureStorageAccount[]> { await this.initializeClients(); if (!this.storageClient) throw new Error('Storage client not initialized'); try { const accounts: AzureStorageAccount[] = []; const accountList = this.storageClient.storageAccounts.list(); for await (const account of accountList) { if (account.id && account.name) { accounts.push({ id: account.id, type: 'storage', name: account.name, resourceGroup: this.extractResourceGroup(account.id), location: account.location || this.location, status: 'running', accountName: account.name, kind: account.kind || '', sku: account.sku?.name, accessTier: account.accessTier, tags: account.tags, }); } } return accounts; } catch (error) { throw new Error(`Failed to list storage accounts: ${error instanceof Error ? error.message : String(error)}`); } }
- src/server.ts:19-27 (registration)Registers all tools including azureTools (containing 'azure_list_storage_accounts') into the main allTools array used for MCP listTools response.const allTools = [ ...awsTools, ...azureTools, ...gcpTools, ...resourceManagementTools, ...costAnalysisTools, ...monitoringTools, ...securityTools, ];
- src/server.ts:66-67 (registration)Registers the routing for azure tools including 'azure_list_storage_accounts' to the specific handleAzureTool function.} else if (azureTools.some((t) => t.name === name)) { result = await handleAzureTool(name, args || {});