ks_enable_addon
Enable a specified add-on for a Kubernetes cluster to extend its functionality, solving the need for additional services.
Instructions
Enable a cluster add-on
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cluster | Yes | ||
| addon_name | Yes |
Implementation Reference
- src/tools/kubernetes/index.ts:79-83 (registration)Tool 'ks_enable_addon' is registered via server.tool() with schema for 'cluster' and 'addon_name' parameters and a handler that calls client.patch to enable the addon.
server.tool("ks_enable_addon", "Enable a cluster add-on", { cluster: z.string(), addon_name: z.string(), }, async (p) => safeTool(async () => { w(); return client.patch(`${base}/v1/clusters/${p.cluster}/addons`, {[p.addon_name]:{enabled:true}}); })); - src/tools/kubernetes/index.ts:79-83 (handler)The handler function (async (p) => ...) executes the tool logic: calls assertWriteAllowed via the w() helper, then sends a PATCH request to enable the addon on the given cluster.
server.tool("ks_enable_addon", "Enable a cluster add-on", { cluster: z.string(), addon_name: z.string(), }, async (p) => safeTool(async () => { w(); return client.patch(`${base}/v1/clusters/${p.cluster}/addons`, {[p.addon_name]:{enabled:true}}); })); - src/tools/kubernetes/index.ts:79-80 (schema)Input schema: 'cluster' (z.string()) and 'addon_name' (z.string()) are validated using Zod.
server.tool("ks_enable_addon", "Enable a cluster add-on", { cluster: z.string(), addon_name: z.string(), - src/lib/utils.ts:14-17 (helper)assertWriteAllowed helper: called at the start of the handler via w() to ensure write operations are permitted.
export function assertWriteAllowed(allowWrite: boolean): void { if (!allowWrite) { throw new WriteNotAllowedError(); } - src/lib/api-client.ts:140-146 (helper)client.patch helper: the HTTP PATCH method used to send the enable request to the IBM Cloud Kubernetes API.
async patch<T = unknown>(url: string, body?: unknown, queryParams?: Record<string, string | number | boolean | undefined>): Promise<T> { return this.request<T>(url, { method: "PATCH", body, queryParams }); } async delete<T = unknown>(url: string, queryParams?: Record<string, string | number | boolean | undefined>): Promise<T> { return this.request<T>(url, { method: "DELETE", queryParams }); }