Skip to main content
Glama

get-role-definitions

List available Azure role definitions to manage access control and permissions for resources within your subscription or specified scope.

Instructions

List available role definitions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scopeNoScope for role definitions. Leave empty for subscription level.

Implementation Reference

  • Switch case in handleCallTool that registers and routes the 'get-role-definitions' tool call to its handler function.
    case "get-role-definitions": result = await this.handleGetRoleDefinitions(args); break;
  • Tool schema definition returned by listTools, specifying the name, description, and input schema (optional scope parameter).
    { name: "get-role-definitions", description: "List available role definitions", inputSchema: { type: "object", properties: { scope: { type: "string", description: "Scope for role definitions. Leave empty for subscription level.", }, }, required: [], }, },
  • Primary handler implementation that parses input arguments, lists role definitions using Azure AuthorizationManagementClient.roleDefinitions.list(), formats the results, and handles errors.
    private async handleGetRoleDefinitions(args: any) { const { scope } = z .object({ scope: z.string().optional(), }) .parse(args); if (!this.context.authorizationClient) { throw new AzureMCPError( "Authorization client not initialized", "NO_CLIENT" ); } try { const roleDefinitions = []; const definitionScope = scope || `/subscriptions/${this.context.selectedSubscription}`; for await (const definition of this.context.authorizationClient.roleDefinitions.list( definitionScope )) { roleDefinitions.push({ id: definition.id, name: definition.name, roleName: definition.roleName, description: definition.description, type: definition.type, permissions: definition.permissions?.map((p) => ({ actions: p.actions, notActions: p.notActions, dataActions: p.dataActions, notDataActions: p.notDataActions, })), }); } return { roleDefinitions, total: roleDefinitions.length }; } catch (error) { this.logWithContext("error", `Error getting role definitions: ${error}`, { error, }); throw new AzureResourceError(`Failed to get role definitions: ${error}`); } }

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