Skip to main content
Glama

list_node_pools

Retrieve a list of node pools in a specified GKE cluster by providing the GCP project ID, cluster name, and location. Simplify cluster management within the GCP MCP system.

Instructions

    List node pools in a 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:
        List of node pools in the specified GKE cluster
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cluster_nameYes
locationYes
project_idYes

Implementation Reference

  • The handler function for the 'list_node_pools' MCP tool. It is decorated with @mcp.tool() which also serves as registration. The function uses the Google Cloud Container client to list node pools in a GKE cluster, formats the information including machine types, autoscaling settings, and labels, and returns a formatted string.
        @mcp.tool()
        def list_node_pools(project_id: str, cluster_name: str, location: str) -> str:
            """
            List node pools in a 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:
                List of node pools in the specified GKE cluster
            """
            try:
                from google.cloud import container_v1
                
                # Initialize the GKE client
                client = container_v1.ClusterManagerClient()
                
                # List node pools
                cluster_path = f"projects/{project_id}/locations/{location}/clusters/{cluster_name}"
                node_pools = client.list_node_pools(parent=cluster_path)
                
                # Format the response
                pools_list = []
                for pool in node_pools.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
                    
                    pool_info = [
                        f"- {pool.name}:",
                        f"  Machine Type: {machine_type}",
                        f"  Disk Size: {disk_size_gb}GB",
                        f"  Initial Node Count: {initial_nodes}",
                        f"  Autoscaling: {autoscaling}"
                    ]
                    
                    if autoscaling == "Enabled":
                        pool_info.append(f"  Min Nodes: {min_nodes}")
                        pool_info.append(f"  Max Nodes: {max_nodes}")
                    
                    if pool.config.labels:
                        labels = [f"{k}: {v}" for k, v in pool.config.labels.items()]
                        pool_info.append(f"  Labels: {', '.join(labels)}")
                    
                    pools_list.append("\n".join(pool_info))
                
                if not pools_list:
                    return f"No node pools found in GKE cluster {cluster_name} in location {location}."
                
                pools_str = "\n".join(pools_list)
                
                return f"""
    Node Pools in GKE Cluster {cluster_name} (Location: {location}):
    {pools_str}
    """
            except Exception as e:
                return f"Error listing node pools: {str(e)}"
  • The register_tools function that defines and registers all Kubernetes tools, including list_node_pools, by nesting the tool definitions inside it with @mcp.tool() decorators.
    def register_tools(mcp):
        """Register all kubernetes tools with the MCP server."""
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. It mentions the return type ('List of node pools') but doesn't describe pagination behavior, rate limits, authentication requirements, error conditions, or what happens if the cluster doesn't exist. For a read operation with zero annotation coverage, this leaves significant behavioral gaps.

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 parameter and return value sections. Every sentence serves a distinct purpose with zero wasted words, making it easy to parse and understand quickly.

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 read-only list operation with 3 parameters and no output schema, the description covers the basic purpose and parameters adequately. However, it lacks information about return format details, error handling, and behavioral constraints that would be helpful given the complete absence of 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?

The description explicitly lists all three parameters with brief explanations, adding meaningful context beyond the 0% schema description coverage. While it doesn't provide format details or examples, it clearly maps each parameter to its purpose in the operation, compensating well for the schema's lack of descriptions.

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 verb ('List') and resource ('node pools in a GKE cluster'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like 'list_gke_clusters', but the specificity of 'node pools' versus 'clusters' provides implicit distinction.

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 like 'list_gke_clusters' or 'get_cluster_details', nor does it mention prerequisites or contextual constraints. It simply states what the tool does without usage context.

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