Skip to main content
Glama

get_cluster_details

Retrieve detailed information about a specific GKE cluster by providing the GCP project ID, cluster name, and location. Enhances cluster management within the GCP MCP server.

Instructions

    Get detailed information about a specific GKE cluster.
    
    Args:
        project_id: The ID of the GCP project
        cluster_name: The name of the GKE cluster
        location: The location (region or zone) of the cluster
    
    Returns:
        Detailed information about the specified GKE cluster
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cluster_nameYes
locationYes
project_idYes

Implementation Reference

  • The handler function decorated with @mcp.tool() that implements the get_cluster_details tool. It fetches detailed GKE cluster information using the container_v1 client and returns a formatted string.
        @mcp.tool()
        def get_cluster_details(project_id: str, cluster_name: str, location: str) -> str:
            """
            Get detailed information about a specific GKE cluster.
            
            Args:
                project_id: The ID of the GCP project
                cluster_name: The name of the GKE cluster
                location: The location (region or zone) of the cluster
            
            Returns:
                Detailed information about the specified GKE cluster
            """
            try:
                from google.cloud import container_v1
                
                # Initialize the GKE client
                client = container_v1.ClusterManagerClient()
                
                # Get cluster details
                cluster_path = f"projects/{project_id}/locations/{location}/clusters/{cluster_name}"
                cluster = client.get_cluster(name=cluster_path)
                
                # Format the response
                details = []
                details.append(f"Name: {cluster.name}")
                details.append(f"Description: {cluster.description or 'None'}")
                details.append(f"Location: {location}")
                details.append(f"Location Type: {'Regional' if '-' not in location else 'Zonal'}")
                details.append(f"Status: {'Running' if cluster.status == container_v1.Cluster.Status.RUNNING else cluster.status.name}")
                details.append(f"Kubernetes Version: {cluster.current_master_version}")
                details.append(f"Network: {cluster.network}")
                details.append(f"Subnetwork: {cluster.subnetwork}")
                details.append(f"Cluster CIDR: {cluster.cluster_ipv4_cidr}")
                details.append(f"Services CIDR: {cluster.services_ipv4_cidr}")
                details.append(f"Endpoint: {cluster.endpoint}")
                
                # Add Node Pools information
                node_pools = []
                for pool in cluster.node_pools:
                    machine_type = pool.config.machine_type
                    disk_size_gb = pool.config.disk_size_gb
                    autoscaling = "Enabled" if pool.autoscaling and pool.autoscaling.enabled else "Disabled"
                    min_nodes = pool.autoscaling.min_node_count if pool.autoscaling and pool.autoscaling.enabled else "N/A"
                    max_nodes = pool.autoscaling.max_node_count if pool.autoscaling and pool.autoscaling.enabled else "N/A"
                    initial_nodes = pool.initial_node_count
                    
                    node_pools.append(f"  - {pool.name} (Machine: {machine_type}, Disk: {disk_size_gb}GB, Initial Nodes: {initial_nodes})")
                    if autoscaling == "Enabled":
                        node_pools.append(f"    Autoscaling: {autoscaling} (Min: {min_nodes}, Max: {max_nodes})")
                
                if node_pools:
                    details.append(f"Node Pools ({len(cluster.node_pools)}):\n" + "\n".join(node_pools))
                
                # Add Addons information
                addons = []
                if cluster.addons_config:
                    config = cluster.addons_config
                    addons.append(f"  - HTTP Load Balancing: {'Enabled' if not config.http_load_balancing or not config.http_load_balancing.disabled else 'Disabled'}")
                    addons.append(f"  - Horizontal Pod Autoscaling: {'Enabled' if not config.horizontal_pod_autoscaling or not config.horizontal_pod_autoscaling.disabled else 'Disabled'}")
                    addons.append(f"  - Kubernetes Dashboard: {'Enabled' if not config.kubernetes_dashboard or not config.kubernetes_dashboard.disabled else 'Disabled'}")
                    addons.append(f"  - Network Policy: {'Enabled' if config.network_policy_config and not config.network_policy_config.disabled else 'Disabled'}")
                
                if addons:
                    details.append(f"Addons:\n" + "\n".join(addons))
                
                details_str = "\n".join(details)
                
                return f"""
    GKE Cluster Details:
    {details_str}
    """
            except Exception as e:
                return f"Error getting cluster details: {str(e)}"
  • The call to register_tools from the kubernetes module, which registers the get_cluster_details tool via its @mcp.tool() decorator.
    kubernetes_tools.register_tools(mcp)
  • Import of the kubernetes tools module, providing access to register_tools which registers the get_cluster_details tool.
    from .gcp_modules.kubernetes import tools as kubernetes_tools
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states this is a 'Get' operation, implying read-only behavior, but doesn't disclose authentication requirements, rate limits, error conditions, or what 'detailed information' includes (e.g., structure, fields). This is a significant gap for a tool with no annotation coverage.

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 appropriately sized and front-loaded with the purpose, followed by structured Args and Returns sections. Every sentence earns its place, though the Returns statement is somewhat vague ('Detailed information'). No wasted text.

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 (3 required parameters, no annotations, no output schema), the description is minimally adequate. It covers the purpose and parameters but lacks behavioral context (e.g., auth, errors) and output details. Without annotations or output schema, more completeness is needed for a read operation.

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 lists all three parameters (project_id, cluster_name, location) with brief explanations, adding meaning beyond the schema which has 0% description coverage. It clarifies what each parameter represents, though it doesn't provide format details (e.g., location syntax). With 0% schema coverage, this compensates well but not fully.

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 tool's purpose: 'Get detailed information about a specific GKE cluster.' It specifies the verb ('Get') and resource ('GKE cluster'), though it doesn't explicitly differentiate from sibling tools like 'list_gke_clusters' or 'get_instance_details' beyond the resource type.

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 sibling tools like 'list_gke_clusters' for listing clusters or 'get_instance_details' for other resource types, nor does it specify prerequisites or exclusions for usage.

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

Related 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/henihaddad/gcp-mcp'

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