Skip to main content
Glama

list-tenants

Retrieve all available Azure tenants for simplified multi-tenant management, enabling efficient resource access and configuration across your Azure environment.

Instructions

List all available Azure tenants

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the list-tenants tool, fetching tenants and subscriptions using Azure SubscriptionClient with retry logic, caching not used here, and proper error handling.
    private async handleListTenants() { try { const creds = new DefaultAzureCredential(); const client = new SubscriptionClient(creds); const [tenants, subscriptions] = await Promise.all([ this.executeWithRetry(async () => { const items = []; for await (const tenant of client.tenants.list()) { items.push({ id: tenant.tenantId, name: tenant.displayName, }); } return items; }), this.executeWithRetry(async () => { const items = []; for await (const sub of client.subscriptions.list()) { items.push({ id: sub.subscriptionId, name: sub.displayName, state: sub.state, }); } return items; }), ]); return this.createTextResponse( JSON.stringify({ tenants, subscriptions }) ); } catch (error) { this.logWithContext("error", `Error listing tenants: ${error}`, { error, }); throw new AzureAuthenticationError( `Failed to list tenants and subscriptions: ${error}` ); } }
  • Registration of the list-tenants tool in the handleListTools method, including name, description, and input schema (empty object).
    { name: "list-tenants", description: "List all available Azure tenants", inputSchema: { type: "object", properties: {}, required: [], }, },
  • Switch case in handleCallTool that dispatches to the list-tenants handler.
    case "list-tenants": result = await this.handleListTenants(); 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