resource_update_instance
Update the name, plan, or parameters of an existing IBM Cloud resource instance.
Instructions
Update a resource instance (name, plan, etc.)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| instance_id | Yes | ||
| name | No | ||
| resource_plan_id | No | ||
| parameters | No | JSON string of parameters |
Implementation Reference
- src/tools/resource-management/index.ts:42-51 (registration)Registration of the 'resource_update_instance' tool with its schema and handler via server.tool() call. Defines the tool name, description, input schema (instance_id required; name, resource_plan_id, parameters optional), and the async handler that validates write permissions and sends a PATCH request.
server.tool("resource_update_instance", "Update a resource instance (name, plan, etc.)", { instance_id: z.string(), name: z.string().optional(), resource_plan_id: z.string().optional(), parameters: z.string().optional().describe("JSON string of parameters"), }, async (p) => safeTool(async () => { w(); const body: Record<string,unknown> = {}; if(p.name) body.name=p.name; if(p.resource_plan_id) body.resource_plan_id=p.resource_plan_id; if(p.parameters) body.parameters=JSON.parse(p.parameters); return client.patch(`${base}/resource_instances/${encodeURIComponent(p.instance_id)}`, body); })); - Input schema for the tool: instance_id (z.string(), required), name (z.string().optional()), resource_plan_id (z.string().optional()), and parameters (z.string().optional() with description 'JSON string of parameters').
server.tool("resource_update_instance", "Update a resource instance (name, plan, etc.)", { instance_id: z.string(), name: z.string().optional(), resource_plan_id: z.string().optional(), parameters: z.string().optional().describe("JSON string of parameters"), - Handler function that builds a body object with only the provided optional fields (name, resource_plan_id, parameters), parses the parameters JSON string if present, and sends a PATCH request to the resource instances API endpoint. Wraps execution in safeTool() for error handling and asserts write permission via w().
}, async (p) => safeTool(async () => { w(); const body: Record<string,unknown> = {}; if(p.name) body.name=p.name; if(p.resource_plan_id) body.resource_plan_id=p.resource_plan_id; if(p.parameters) body.parameters=JSON.parse(p.parameters); return client.patch(`${base}/resource_instances/${encodeURIComponent(p.instance_id)}`, body); })); - The registerResourceManagementTools function that is exported and called from server.ts (line 77) to register all resource management tools including resource_update_instance.
export function registerResourceManagementTools(server: McpServer, client: IBMCloudAPIClient, config: ServerConfig) { - src/server.ts:77-77 (helper)Registration call that wires the resource management tools (including resource_update_instance) into the MCP server.
registerResourceManagementTools(server, client, config);