Skip to main content
Glama
phantosmax

CloudStack MCP Server

by phantosmax

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
NameRequiredDescriptionDefault
forcedNoForce stop the VM
idYesVM 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);
  • 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);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/phantosmax/cloudstack-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server