ks_get_cluster_config
Retrieve the kubeconfig for an IBM Cloud Kubernetes cluster. Use this tool to obtain configuration credentials for cluster access.
Instructions
Get cluster kubeconfig
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"cluster": "<cluster>"
},
"name": "ks_get_cluster_config"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cluster | Yes |
Implementation Reference
- src/tools/kubernetes/index.ts:72-74 (registration)Registration of the 'ks_get_cluster_config' tool via server.tool(), defining its schema (cluster: z.string()) and handler.
server.tool("ks_get_cluster_config", "Get cluster kubeconfig", { cluster: z.string(), }, async (p) => safeTool(() => client.get(`${base}/v2/getKubeconfig`, {cluster:p.cluster}))); - src/tools/kubernetes/index.ts:73-73 (schema)Input schema for the tool: requires a single 'cluster' string parameter (validated with zod).
cluster: z.string(), - src/tools/kubernetes/index.ts:74-74 (handler)The handler function calls client.get() to fetch kubeconfig from IBM Cloud Kubernetes API endpoint v2/getKubeconfig with the cluster parameter, wrapped in safeTool() for error handling.
}, async (p) => safeTool(() => client.get(`${base}/v2/getKubeconfig`, {cluster:p.cluster}))); - src/lib/utils.ts:70-77 (helper)The safeTool() helper wraps the handler, catching errors and returning proper MCP success/error content blocks.
export async function safeTool<T>(fn: () => Promise<T>): Promise<ReturnType<typeof successContent> | ReturnType<typeof errorContent>> { try { const result = await fn(); return successContent(result); } catch (error) { return errorContent(error); } } - src/config.ts:37-37 (helper)The KUBERNETES endpoint constant ('https://containers.cloud.ibm.com/global') used as the base URL for the API call.
KUBERNETES: "https://containers.cloud.ibm.com/global",