Skip to main content
Glama

get_oke_cluster_kubeconfig

Retrieve kubeconfig content for accessing an Oracle Container Engine (OKE) cluster, enabling kubectl connectivity and Kubernetes cluster management.

Instructions

Get the kubeconfig file content for accessing an OKE cluster.

Args:
    cluster_id: OCID of the cluster

Returns:
    Kubeconfig content in YAML format that can be saved to ~/.kube/config
    or used with kubectl --kubeconfig flag

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cluster_idYes

Implementation Reference

  • Core handler function that executes the logic to fetch kubeconfig from OCI Container Engine using the create_kubeconfig API.
    def get_cluster_kubeconfig(container_engine_client: oci.container_engine.ContainerEngineClient,
                               cluster_id: str) -> Dict[str, Any]:
        """
        Get the kubeconfig for a specific OKE cluster.
    
        Args:
            container_engine_client: OCI ContainerEngine client
            cluster_id: OCID of the cluster
    
        Returns:
            Kubeconfig content and metadata
        """
        try:
            # Create kubeconfig request
            create_kubeconfig_details = oci.container_engine.models.CreateClusterKubeconfigContentDetails()
    
            # Get the kubeconfig
            kubeconfig_response = container_engine_client.create_kubeconfig(
                cluster_id,
                create_kubeconfig_details
            )
    
            # Read the kubeconfig content
            kubeconfig_content = kubeconfig_response.data.content.decode('utf-8') if hasattr(kubeconfig_response.data, 'content') else kubeconfig_response.data.text
    
            result = {
                "cluster_id": cluster_id,
                "kubeconfig": kubeconfig_content,
                "format": "yaml",
                "usage": "Save this content to ~/.kube/config or use with kubectl --kubeconfig flag",
            }
    
            logger.info(f"Retrieved kubeconfig for cluster {cluster_id}")
            return result
    
        except Exception as e:
            logger.exception(f"Error getting cluster kubeconfig: {e}")
            raise
  • MCP tool registration with name 'get_oke_cluster_kubeconfig' and wrapper handler that invokes the core implementation from oke.py.
    @mcp.tool(name="get_oke_cluster_kubeconfig")
    @mcp_tool_wrapper(
        start_msg="Getting kubeconfig for cluster {cluster_id}...",
        error_prefix="Error getting cluster kubeconfig"
    )
    async def mcp_get_oke_cluster_kubeconfig(ctx: Context, cluster_id: str) -> Dict[str, Any]:
        """
        Get the kubeconfig file content for accessing an OKE cluster.
    
        Args:
            cluster_id: OCID of the cluster
    
        Returns:
            Kubeconfig content in YAML format that can be saved to ~/.kube/config
            or used with kubectl --kubeconfig flag
        """
        return get_cluster_kubeconfig(oci_clients["container_engine"], cluster_id)
  • Import statement that brings the get_cluster_kubeconfig helper function into scope for use in the MCP server.
    from mcp_server_oci.tools.oke import (
        list_clusters,
        get_cluster,
        list_node_pools,
        get_node_pool,
        get_cluster_kubeconfig,
        list_work_requests,
        get_work_request,
    )
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 the tool retrieves kubeconfig content but omits critical behavioral details: whether this requires specific permissions, if the cluster must be active, potential rate limits, or if the operation is idempotent. For a tool that accesses sensitive cluster credentials, this is a significant gap.

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 efficiently structured with a clear purpose statement followed by dedicated Args and Returns sections. Every sentence earns its place by explaining what the tool does, what it requires, and what it produces, with zero redundant information.

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 moderate complexity (retrieving sensitive configuration data) with no annotations and no output schema, the description is partially complete. It adequately explains the purpose and return format but lacks behavioral context about permissions, cluster state requirements, and security implications that would be important for safe usage.

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 explicitly documents the single parameter 'cluster_id' with its purpose ('OCID of the cluster'), adding essential semantic meaning beyond the schema's 0% coverage. While it doesn't elaborate on OCID format or validation, it provides sufficient context for the agent to understand what this parameter represents.

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 ('Get the kubeconfig file content') and resource ('for accessing an OKE cluster'), distinguishing it from sibling tools like 'get_oke_cluster' which likely retrieves cluster metadata rather than configuration files. The purpose is unambiguous and well-specified.

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, such as whether it's for initial cluster setup, troubleshooting, or automation. It doesn't mention prerequisites like cluster state requirements or authentication context, leaving usage context entirely implicit.

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