list_kubernetes_clusters
Retrieve all Kubernetes clusters in your Civo cloud account to monitor and manage your containerized applications.
Instructions
List all Kubernetes clusters on Civo
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| region | No | Region identifier |
Implementation Reference
- src/index.ts:473-488 (handler)The main handler for the 'list_kubernetes_clusters' tool within the CallToolRequestSchema switch statement. It invokes the listClusters helper, formats the cluster list as text, and returns the response.
case 'list_kubernetes_clusters': { const clusters = await listClusters(args); const clusterList = clusters.items .map((c: any) => `${c.name} (${c.id}) - ${c.status}`) .join('\n'); return { content: [ { type: 'text', text: `Kubernetes Clusters:\n${clusterList}`, }, ], isError: false, }; } - src/tools/kubernetes.ts:3-15 (schema)Defines the tool schema including name, description, and inputSchema with optional 'region' parameter.
export const LIST_KUBERNETES_CLUSTERS_TOOL: Tool = { name: 'list_kubernetes_clusters', description: 'List all Kubernetes clusters on Civo', inputSchema: { type: 'object', properties: { region: { type: 'string', description: 'Region identifier', }, }, }, }; - src/index.ts:86-86 (registration)Registers the tool in the server capabilities.tools object for MCP protocol advertisement.
[LIST_KUBERNETES_CLUSTERS_TOOL.name]: LIST_KUBERNETES_CLUSTERS_TOOL, - src/index.ts:113-113 (registration)Includes the tool in the list returned by ListToolsRequestHandler.
LIST_KUBERNETES_CLUSTERS_TOOL, - src/api/kubernetes.ts:10-31 (helper)API client helper that fetches the list of Kubernetes clusters from the Civo API, handling region param and rate limiting.
export async function listClusters(params: { region?: string; }): Promise<CivoKubernetesClusterList> { checkRateLimit(); const url = new URL(`${CIVO_API_URL}/kubernetes/clusters`); if (params.region) url.searchParams.set('region', params.region); const response = await fetch(url.toString(), { headers: { Authorization: `Bearer ${CIVO_API_KEY}`, }, }); if (!response.ok) { throw new Error( `Civo API error: ${response.status} ${response.statusText}` ); } return response.json(); }