db_set_scaling
Configure CPU, memory, and disk resources for a database deployment by specifying allocation counts and region.
Instructions
Set scaling for a database deployment
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deployment_id | Yes | ||
| group_id | No | ||
| cpu_allocation_count | No | ||
| memory_mb | No | ||
| disk_mb | No | ||
| region | No |
Implementation Reference
- src/tools/databases/index.ts:68-74 (handler)Handler function for db_set_scaling tool. Validates write permissions, builds a request body with cpu/memory/disk scaling parameters, and sends a PATCH request to the IBM Cloud Databases API to update scaling configuration.
}, async (p) => safeTool(async () => { w(); const body: Record<string,unknown> = {}; if(p.cpu_allocation_count) body.cpu={allocation_count:p.cpu_allocation_count}; if(p.memory_mb) body.memory={allocation_mb:p.memory_mb}; if(p.disk_mb) body.disk={allocation_mb:p.disk_mb}; return client.patch(`${base(p.region||r)}/deployments/${encodeURIComponent(p.deployment_id)}/groups/${p.group_id||"member"}`, body); })); - src/tools/databases/index.ts:65-67 (schema)Zod schema defining input parameters for db_set_scaling: deployment_id (required), group_id (optional), cpu_allocation_count (optional number), memory_mb (optional number), disk_mb (optional number), region (optional string).
deployment_id: z.string(), group_id: z.string().optional(), cpu_allocation_count: z.number().optional(), memory_mb: z.number().optional(), disk_mb: z.number().optional(), region: z.string().optional(), - src/tools/databases/index.ts:64-74 (registration)Registration of db_set_scaling tool on the MCP server via server.tool(), within registerDatabaseTools() function. Registered along with 9 other database tools in the same file.
server.tool("db_set_scaling", "Set scaling for a database deployment", { deployment_id: z.string(), group_id: z.string().optional(), cpu_allocation_count: z.number().optional(), memory_mb: z.number().optional(), disk_mb: z.number().optional(), region: z.string().optional(), }, async (p) => safeTool(async () => { w(); const body: Record<string,unknown> = {}; if(p.cpu_allocation_count) body.cpu={allocation_count:p.cpu_allocation_count}; if(p.memory_mb) body.memory={allocation_mb:p.memory_mb}; if(p.disk_mb) body.disk={allocation_mb:p.disk_mb}; return client.patch(`${base(p.region||r)}/deployments/${encodeURIComponent(p.deployment_id)}/groups/${p.group_id||"member"}`, body); })); - src/tools/databases/index.ts:8-9 (helper)Helper to build the base URL for IBM Cloud Databases API using the region-specific endpoint pattern https://api.{region}.databases.cloud.ibm.com/v5/ibm.
const base = (r: string) => IBM_ENDPOINTS.DATABASES(r); const w = () => assertWriteAllowed(config.allowWrite); - src/lib/utils.ts:70-77 (helper)Utility wrapper that executes the tool's callback safely, returning a success or error MCP response.
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); } }