Skip to main content
Glama

create-resource-group

Define and organize Azure resources by establishing a resource group with specific name, location, and optional tags for streamlined management.

Instructions

Create a new resource group

Input Schema

NameRequiredDescriptionDefault
locationYesAzure region
nameYesResource group name
tagsNoResource tags (optional)

Input Schema (JSON Schema)

{ "properties": { "location": { "description": "Azure region", "type": "string" }, "name": { "description": "Resource group name", "type": "string" }, "tags": { "description": "Resource tags (optional)", "type": "object" } }, "required": [ "name", "location" ], "type": "object" }

Implementation Reference

  • Primary handler method for 'create-resource-group' tool. Validates input parameters using Zod and calls AzureOperations.createResourceGroup to perform the creation.
    private async handleCreateResourceGroup(args: any) { const { name, location, tags } = z .object({ name: z.string().min(1, "Resource group name cannot be empty"), location: z.string().min(1, "Location cannot be empty"), tags: z.record(z.string()).optional(), }) .parse(args); if (!this.context.resourceClient) { throw new AzureMCPError("Client not initialized", "NO_CLIENT"); } try { // Use azureOperations to create the resource group const result = await this.azureOperations.createResourceGroup( name, location, tags ); // Invalidate cache for resource groups list this.resourceCache.delete( `resource-groups-${this.context.selectedSubscription}` ); return { id: result.id, name: result.name, location: result.location, tags: result.tags || {}, provisioningState: result.properties?.provisioningState, }; } catch (error) { this.logWithContext("error", `Error creating resource group: ${error}`, { error, }); throw new AzureResourceError(`Failed to create resource group: ${error}`); } }
  • Core implementation in AzureOperations class that executes the Azure SDK call to create or update the resource group.
    async createResourceGroup( name: string, location: string, tags?: Record<string, string> ) { if (!this.context.resourceClient) { throw new AzureMCPError("Client not initialized", "NO_CLIENT"); } return await this.context.resourceClient.resourceGroups.createOrUpdate( name, { location, tags } ); }
  • Input schema definition for the 'create-resource-group' tool, defining parameters name, location, and optional tags.
    name: "create-resource-group", description: "Create a new resource group", inputSchema: { type: "object", properties: { name: { type: "string", description: "Resource group name", }, location: { type: "string", description: "Azure region", }, tags: { type: "object", description: "Resource tags (optional)", }, }, required: ["name", "location"], }, },
  • Switch case in handleCallTool that registers and routes calls to the 'create-resource-group' handler.
    case "create-resource-group": result = await this.handleCreateResourceGroup(args); break;

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kalivaraprasad-gonapa/azure-mcp'

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