scale_virtual_machine
Adjust the service offering of a virtual machine by specifying its ID and the desired service offering ID to scale resources effectively on the CloudStack MCP Server.
Instructions
Scale virtual machine (change service offering)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | VM ID to scale | |
| serviceofferingid | Yes | New service offering ID |
Implementation Reference
- The main handler function that executes the scale_virtual_machine tool. It calls the CloudStackClient to scale the VM and returns a formatted text response with the job ID.
async handleScaleVirtualMachine(args: any) { const result = await this.cloudStackClient.scaleVirtualMachine(args); return { content: [ { type: 'text', text: `Scaled virtual machine ${args.id}. Job ID: ${result.scalevirtualmachineresponse?.jobid}` } ] }; } - Tool schema definition including name, description, and input validation schema for the scale_virtual_machine tool.
{ name: 'scale_virtual_machine', description: 'Scale virtual machine (change service offering)', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'VM ID to scale', }, serviceofferingid: { type: 'string', description: 'New service offering ID', }, }, required: ['id', 'serviceofferingid'], additionalProperties: false, }, }, - src/server.ts:122-123 (registration)Registration in the MCP server switch statement that dispatches calls to the scale_virtual_machine handler.
case 'scale_virtual_machine': return await this.vmHandlers.handleScaleVirtualMachine(args); - src/cloudstack-client.ts:143-145 (helper)Helper method in CloudStackClient that wraps the API request for scaling a virtual machine.
async scaleVirtualMachine(params: CloudStackParams): Promise<CloudStackResponse> { return this.request('scaleVirtualMachine', params); } - src/server.ts:97-99 (registration)Tool list registration via allToolDefinitions which includes the scale_virtual_machine tool schema.
return { tools: allToolDefinitions, };