Skip to main content
Glama

list_autonomous_databases

Retrieve Autonomous Databases in a specified OCI compartment to view configurations, workload types, and connection details for management.

Instructions

List all Autonomous Databases in a compartment.

Args:
    compartment_id: OCID of the compartment to list Autonomous Databases from

Returns:
    List of Autonomous Databases with their configuration, workload type, and connection info

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
compartment_idYes

Implementation Reference

  • Core implementation of the list_autonomous_databases tool handler. Uses OCI DatabaseClient to fetch and paginate autonomous databases, extracts relevant fields into structured dicts, and handles errors.
    def list_autonomous_databases(database_client: oci.database.DatabaseClient, compartment_id: str) -> List[Dict[str, Any]]:
        """
        List all autonomous databases in a compartment.
        
        Args:
            database_client: OCI Database client
            compartment_id: OCID of the compartment
            
        Returns:
            List of autonomous databases with their details
        """
        try:
            autonomous_databases_response = oci.pagination.list_call_get_all_results(
                database_client.list_autonomous_databases,
                compartment_id
            )
            
            autonomous_databases = []
            for adb in autonomous_databases_response.data:
                autonomous_databases.append({
                    "id": adb.id,
                    "db_name": adb.db_name,
                    "display_name": adb.display_name,
                    "compartment_id": adb.compartment_id,
                    "lifecycle_state": adb.lifecycle_state,
                    "time_created": str(adb.time_created),
                    "cpu_core_count": adb.cpu_core_count,
                    "data_storage_size_in_tbs": adb.data_storage_size_in_tbs,
                    "is_free_tier": adb.is_free_tier,
                    "is_auto_scaling_enabled": adb.is_auto_scaling_enabled,
                    "db_workload": adb.db_workload,
                    "db_version": adb.db_version,
                    "license_model": adb.license_model,
                    "is_dedicated": adb.is_dedicated,
                    "autonomous_container_database_id": adb.autonomous_container_database_id,
                    "is_access_control_enabled": adb.is_access_control_enabled,
                    "whitelisted_ips": adb.whitelisted_ips,
                    "are_primary_whitelisted_ips_used": adb.are_primary_whitelisted_ips_used,
                    "standby_whitelisted_ips": adb.standby_whitelisted_ips,
                    "is_data_guard_enabled": adb.is_data_guard_enabled,
                    "is_local_data_guard_enabled": adb.is_local_data_guard_enabled,
                    "subnet_id": adb.subnet_id,
                    "nsg_ids": adb.nsg_ids,
                    "private_endpoint": adb.private_endpoint,
                    "private_endpoint_label": adb.private_endpoint_label,
                })
            
            logger.info(f"Found {len(autonomous_databases)} autonomous databases in compartment {compartment_id}")
            return autonomous_databases
            
        except Exception as e:
            logger.exception(f"Error listing autonomous databases: {e}")
            raise
  • MCP tool registration and wrapper handler for 'list_autonomous_databases'. Registers the tool with FastMCP, applies common error handling wrapper, and delegates to the core handler function with the OCI database client.
    @mcp.tool(name="list_autonomous_databases")
    @mcp_tool_wrapper(
        start_msg="Listing Autonomous Databases in compartment {compartment_id}...",
        error_prefix="Error listing Autonomous Databases"
    )
    async def mcp_list_autonomous_databases(ctx: Context, compartment_id: str) -> List[Dict[str, Any]]:
        """
        List all Autonomous Databases in a compartment.
    
        Args:
            compartment_id: OCID of the compartment to list Autonomous Databases from
    
        Returns:
            List of Autonomous Databases with their configuration, workload type, and connection info
        """
        return list_autonomous_databases(oci_clients["database"], compartment_id)
  • Import of the list_autonomous_databases helper function from tools/database.py into the main server module.
    from mcp_server_oci.tools.database import (
        list_db_systems as list_db_systems_dbpkg,  # alias to avoid name clash
        get_db_system as get_db_system_dbpkg,
        list_databases,
        get_database,
        list_autonomous_databases,
        get_autonomous_database,
    )

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