Skip to main content
Glama

create-resource-group

Create a new Azure resource group to organize and manage cloud resources by specifying name, location, and optional tags.

Instructions

Create a new resource group

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesResource group name
locationYesAzure region
tagsNoResource tags (optional)

Implementation Reference

  • Core handler function in AzureOperations class that performs the actual resource group creation using Azure ResourceManagementClient's createOrUpdate method.
    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 } ); }
  • Primary MCP tool handler method that validates input arguments using Zod, delegates to AzureOperations.createResourceGroup, invalidates cache, and formats the response.
    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}`); } }
  • Tool registration in handleListTools method, defining the tool name, description, and input schema for MCP protocol.
    { 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 dispatches calls to the specific handler for 'create-resource-group' tool.
    case "create-resource-group": result = await this.handleCreateResourceGroup(args); break;
  • Zod schema validation for input arguments in the handler function, providing additional runtime type checking.
    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);

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