Skip to main content
Glama

list-tenants

Retrieve all Azure tenants accessible through the Azure MCP Server for tenant selection and management.

Instructions

List all available Azure tenants

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handleListTenants method implements the core logic for the 'list-tenants' tool. It creates a SubscriptionClient with DefaultAzureCredential to list all accessible tenants using client.tenants.list() and subscriptions using client.subscriptions.list(), then returns a JSON object containing both lists.
    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}`
        );
      }
    }
  • Registers the 'list-tenants' tool in the handleListTools response, providing name, description, and input schema (empty object, no required parameters).
    {
      name: "list-tenants",
      description: "List all available Azure tenants",
      inputSchema: {
        type: "object",
        properties: {},
        required: [],
      },
    },
  • In the handleCallTool switch statement, the 'list-tenants' case delegates execution to the handleListTenants handler method.
    case "list-tenants":
      result = await this.handleListTenants();
      break;
  • Input schema for 'list-tenants' tool: an empty object with no properties or required fields.
    inputSchema: {
      type: "object",
      properties: {},
      required: [],
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states it 'lists all available Azure tenants,' implying a read-only operation, but doesn't specify whether it requires authentication, returns paginated results, or has any rate limits. This leaves gaps in understanding the tool's behavior beyond the basic action.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with no wasted words. It's front-loaded with the core action ('List all available Azure tenants'), making it easy to parse quickly. Every word contributes directly to the purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is adequate but has gaps. It covers the basic purpose but lacks context on usage, authentication needs, or output format, which could be important for an AI agent to use it correctly in a broader Azure management scenario.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, and schema description coverage is 100%, so there's no need for parameter details in the description. The description appropriately doesn't mention parameters, which is correct for a parameterless tool, earning a baseline score of 4 for not adding unnecessary information.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('Azure tenants'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'select-tenant' or 'list-resource-groups', which would require mentioning this specifically lists tenants rather than resources or role assignments.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., authentication), when it's appropriate (e.g., for tenant selection), or contrast with siblings like 'select-tenant' (which might choose a tenant) or 'list-resource-groups' (which lists resources within a tenant).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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