Skip to main content
Glama

list_availability_domains

Retrieve availability domains in an Oracle Cloud Infrastructure compartment to identify fault-tolerant zones for resource deployment.

Instructions

List all availability domains in a compartment.

Args:
    compartment_id: OCID of the compartment (typically use tenancy OCID for root)

Returns:
    List of availability domains with their names and IDs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
compartment_idYes

Implementation Reference

  • Core handler function that executes the OCI API call to list availability domains, processes the response, and returns formatted list.
    def list_availability_domains(identity_client: oci.identity.IdentityClient, compartment_id: str) -> List[Dict[str, Any]]:
        """
        List all availability domains in a compartment.
        
        Args:
            identity_client: OCI Identity client
            compartment_id: OCID of the compartment
            
        Returns:
            List of availability domains with their details
        """
        try:
            ads_response = identity_client.list_availability_domains(compartment_id)
            
            ads = []
            for ad in ads_response.data:
                ads.append({
                    "name": ad.name,
                    "id": ad.id,
                    "compartment_id": ad.compartment_id,
                })
            
            logger.info(f"Found {len(ads)} availability domains in compartment {compartment_id}")
            return ads
            
        except Exception as e:
            logger.exception(f"Error listing availability domains: {e}")
            raise
  • MCP tool registration using @mcp.tool decorator. This wrapper function handles MCP context, logging, error handling, and delegates to the core handler.
    @mcp.tool(name="list_availability_domains")
    @mcp_tool_wrapper(
        start_msg="Listing availability domains in compartment {compartment_id}...",
        error_prefix="Error listing availability domains"
    )
    async def mcp_list_availability_domains(ctx: Context, compartment_id: str) -> List[Dict[str, Any]]:
        """
        List all availability domains in a compartment.
    
        Args:
            compartment_id: OCID of the compartment (typically use tenancy OCID for root)
    
        Returns:
            List of availability domains with their names and IDs
        """
        return list_availability_domains(oci_clients["identity"], compartment_id)
  • Import statement that brings the handler function into scope for registration in the MCP server.
    from mcp_server_oci.tools.resources import (
        list_availability_domains,
        list_fault_domains,
        list_images,
        get_image,
        list_shapes,
        get_namespace,
        list_regions,
        get_tenancy_info,
    )
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While it states this is a list operation (implying read-only) and describes the return format, it doesn't address important behavioral aspects like pagination, rate limits, authentication requirements, error conditions, or whether this operation has any side effects. The description provides basic functional information but lacks operational context.

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

Conciseness4/5

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

The description is well-structured with clear sections (purpose statement, Args, Returns) and uses only three sentences total. Each sentence earns its place by providing distinct information. The structure is front-loaded with the core purpose first, followed by parameter and return details. Minor improvement could be integrating the guidance more naturally into the flow.

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?

For a simple list operation with 1 parameter and no output schema, the description provides adequate functional coverage but lacks operational context. It explains what the tool does and what it returns, but doesn't address how it behaves (pagination, errors, etc.). Given the absence of annotations and output schema, the description should ideally provide more complete behavioral context for optimal agent understanding.

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 description adds significant value beyond the input schema, which has 0% description coverage. The Args section explains that 'compartment_id' is an 'OCID of the compartment' and provides practical guidance: 'typically use tenancy OCID for root'. This clarifies the parameter's purpose and offers usage advice that isn't in the schema. With only 1 parameter, the description effectively documents its semantics.

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

Purpose5/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 ('availability domains in a compartment'), making the purpose specific and unambiguous. It distinguishes this tool from siblings like 'list_regions' or 'list_fault_domains' by focusing on availability domains specifically.

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

Usage Guidelines3/5

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

The description provides implied usage context by mentioning 'typically use tenancy OCID for root' in the Args section, which helps guide parameter selection. However, it lacks explicit guidance on when to use this tool versus alternatives like 'list_regions' or 'list_fault_domains', and doesn't mention any prerequisites or exclusions.

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/jopsis/mcp-server-oci'

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