stop_virtual_machine
Stop a virtual machine on the CloudStack MCP Server by providing its ID, with an optional parameter to force the shutdown.
Instructions
Stop a virtual machine
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| forced | No | Force stop the VM | |
| id | Yes | VM ID to stop |
Implementation Reference
- The main handler function that executes the stop_virtual_machine tool logic. It calls the CloudStack client to stop the VM and formats a response message with the job ID.async handleStopVirtualMachine(args: any) { const result = await this.cloudStackClient.stopVirtualMachine({ id: args.id, forced: args.forced || false }); return { content: [ { type: 'text', text: `Stopped virtual machine ${args.id}. Job ID: ${result.stopvirtualmachineresponse?.jobid}` } ] }; }
- The tool schema definition including name, description, and input validation schema for the stop_virtual_machine tool.{ name: 'stop_virtual_machine', description: 'Stop a virtual machine', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'VM ID to stop', }, forced: { type: 'boolean', description: 'Force stop the VM', default: false, }, }, required: ['id'], additionalProperties: false, },
- src/server.ts:114-115 (registration)Registration/dispatch of the stop_virtual_machine tool in the MCP server request handler switch statement.case 'stop_virtual_machine': return await this.vmHandlers.handleStopVirtualMachine(args);
- src/cloudstack-client.ts:104-105 (helper)Helper method in CloudStackClient that makes the actual API request to stopVirtualMachine in CloudStack.async stopVirtualMachine(params: CloudStackParams): Promise<CloudStackResponse> { return this.request('stopVirtualMachine', params);