Skip to main content
Glama

list-gke-clusters

Retrieve all Google Kubernetes Engine (GKE) clusters within a specified project. Optionally filter by region or zone to streamline cluster management and monitoring.

Instructions

List all GKE clusters in the current project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
locationNoLocation (region or zone) to list clusters from (defaults to all locations)

Implementation Reference

  • Handler function for 'list-gke-clusters' tool that lists GKE clusters using ClusterManagerClient, optionally filtered by location, requires selected project.
    } else if (name === "list-gke-clusters") { const { location } = ListGKEClustersSchema.parse(args); if (!selectedProject) { return createTextResponse("No project selected. Please select a project first."); } try { const containerClient = new ClusterManagerClient(); const parent = location ? `projects/${selectedProject}/locations/${location}` : `projects/${selectedProject}/locations/-`; const [clusters] = await containerClient.listClusters({ parent }); return createTextResponse(JSON.stringify({ clusters: clusters.clusters?.map((cluster: any) => ({ name: cluster.name || null, location: cluster.location || null, status: cluster.status || null, nodeCount: cluster.currentNodeCount || null, k8sVersion: cluster.currentMasterVersion || null })) || [] }, null, 2)); } catch (error: any) { console.error('Error listing GKE clusters:', error); return createTextResponse(`Error listing GKE clusters: ${error.message}`); }
  • Zod schema for validating input arguments to the list-gke-clusters tool, with optional location parameter.
    const ListGKEClustersSchema = z.object({ location: z.string().optional(), });
  • index.ts:171-184 (registration)
    Registration of the 'list-gke-clusters' tool in the listTools response, including name, description, and input schema.
    { name: "list-gke-clusters", description: "List all GKE clusters in the current project", inputSchema: { type: "object", properties: { location: { type: "string", description: "Location (region or zone) to list clusters from (defaults to all locations)", } }, required: [], }, },

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/RadiumGu/gcp-ops-mcp'

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