Skip to main content
Glama

list_oke_clusters

Retrieve all Kubernetes clusters in an Oracle Cloud compartment to view their configurations, endpoints, and current operational status.

Instructions

List all OKE (Container Engine for Kubernetes) clusters in a compartment.

Args:
    compartment_id: OCID of the compartment

Returns:
    List of OKE clusters with their details including Kubernetes version, endpoints, and lifecycle state

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
compartment_idYes

Implementation Reference

  • Registration of the "list_oke_clusters" MCP tool using @mcp.tool decorator with custom wrapper for logging and error handling.
    @mcp.tool(name="list_oke_clusters")
    @mcp_tool_wrapper(
  • The MCP handler function that receives the MCP context and parameters, calls the core list_clusters helper with the container engine client, and returns the list of clusters.
    async def mcp_list_oke_clusters(ctx: Context, compartment_id: str) -> List[Dict[str, Any]]:
        """
        List all OKE (Container Engine for Kubernetes) clusters in a compartment.
    
        Args:
            compartment_id: OCID of the compartment
    
        Returns:
            List of OKE clusters with their details including Kubernetes version, endpoints, and lifecycle state
        """
        return list_clusters(oci_clients["container_engine"], compartment_id)
  • Core helper function that performs the actual OCI API call to list all OKE clusters in the specified compartment using the ContainerEngineClient, formats the response, and handles logging and exceptions.
    def list_clusters(container_engine_client: oci.container_engine.ContainerEngineClient,
                      compartment_id: str) -> List[Dict[str, Any]]:
        """
        List all OKE clusters in a compartment.
    
        Args:
            container_engine_client: OCI ContainerEngine client
            compartment_id: OCID of the compartment
    
        Returns:
            List of clusters with their details
        """
        try:
            clusters_response = oci.pagination.list_call_get_all_results(
                container_engine_client.list_clusters,
                compartment_id
            )
    
            clusters = []
            for cluster in clusters_response.data:
                clusters.append({
                    "id": cluster.id,
                    "name": cluster.name,
                    "compartment_id": cluster.compartment_id,
                    "lifecycle_state": cluster.lifecycle_state,
                    "lifecycle_details": cluster.lifecycle_details,
                    "vcn_id": cluster.vcn_id,
                    "kubernetes_version": cluster.kubernetes_version,
                    "time_created": str(cluster.time_created) if cluster.time_created else None,
                    "time_updated": str(cluster.time_updated) if cluster.time_updated else None,
                    "endpoint_config": {
                        "subnet_id": cluster.endpoint_config.subnet_id if cluster.endpoint_config else None,
                        "is_public_ip_enabled": cluster.endpoint_config.is_public_ip_enabled if cluster.endpoint_config else None,
                    } if cluster.endpoint_config else None,
                    "type": cluster.type if hasattr(cluster, 'type') else None,
                })
    
            logger.info(f"Found {len(clusters)} OKE clusters in compartment {compartment_id}")
            return clusters
    
        except Exception as e:
            logger.exception(f"Error listing OKE clusters: {e}")
            raise
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states it's a list operation but doesn't disclose behavioral traits like pagination, rate limits, authentication requirements, or whether it's read-only. The description adds minimal context beyond the basic operation.

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 appropriately sized with three sentences: purpose statement, parameter explanation, and return value description. It's front-loaded with the core purpose and has zero wasted content.

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 tool with 1 parameter and no output schema, the description covers basics but lacks completeness. It doesn't explain return format details, error conditions, or behavioral aspects like pagination, which would be helpful given no annotations.

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?

Schema description coverage is 0%, but the description compensates by explaining the single parameter 'compartment_id' as 'OCID of the compartment', adding semantic meaning beyond the schema's generic title 'Compartment Id'. This is sufficient for the single parameter.

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 specific action ('List all OKE clusters') and resource ('OKE clusters in a compartment'), with 'OKE' defined as Container Engine for Kubernetes. It distinguishes from sibling tools like 'get_oke_cluster' (singular retrieval) by emphasizing listing all clusters.

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 implies usage for listing OKE clusters in a compartment, but provides no explicit guidance on when to use this tool versus alternatives like 'get_oke_cluster' or other list tools. No exclusions or prerequisites are mentioned.

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