list-resource-groups
Retrieve all resource groups within a specified Azure subscription to manage cloud resources effectively with secure authentication.
Instructions
List all resource groups in the selected subscription
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/AzureServer.ts:580-601 (handler)Primary MCP tool handler for 'list-resource-groups'. Performs caching, error handling, and delegates to AzureOperations.listResourceGroups() for execution.private async handleListResourceGroups() { if (!this.context.resourceClient) { throw new AzureMCPError("Client not initialized", "NO_CLIENT"); } try { const cacheKey = `resource-groups-${this.context.selectedSubscription}`; return await this.getCachedResource( cacheKey, async () => { // Use azureOperations to handle the business logic return await this.azureOperations.listResourceGroups(); }, 30000 ); } catch (error) { this.logWithContext("error", `Error listing resource groups: ${error}`, { error, }); throw new AzureResourceError(`Failed to list resource groups: ${error}`); } }
- src/AzureServer.ts:963-979 (handler)Core implementation logic in AzureOperations class that lists resource groups using the ResourceManagementClient.async listResourceGroups() { if (!this.context.resourceClient) { throw new AzureMCPError("Client not initialized", "NO_CLIENT"); } const resourceGroups = []; for await (const group of this.context.resourceClient.resourceGroups.list()) { resourceGroups.push({ id: group.id, name: group.name, location: group.location, tags: group.tags || {}, }); } return resourceGroups; }
- src/AzureServer.ts:445-447 (registration)Switch case registration that maps tool name to handler in handleCallTool()case "list-resource-groups": result = await this.handleListResourceGroups(); break;
- src/AzureServer.ts:353-360 (registration)Tool registration in handleListTools() including name, description, and input schema (no required parameters){ name: "list-resource-groups", description: "List all resource groups in the selected subscription", inputSchema: { type: "object", properties: {}, required: [], },
- src/AzureServer.ts:356-360 (schema)Input schema definition for the tool: empty object with no properties or requirements.inputSchema: { type: "object", properties: {}, required: [], },