Skip to main content
Glama
tao12345666333

Civo MCP Server

shutdown_instance

Stop a running cloud instance on Civo to manage costs or perform maintenance. Provide the instance ID and region to initiate shutdown.

Instructions

Shutdown a cloud instance on Civo

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesInstance ID
regionYesRegion identifier

Implementation Reference

  • Core handler function that executes the shutdown logic by calling the Civo API to stop the instance.
    export async function shutdownInstance(params: {
      id: string;
      region: string;
    }): Promise<any> {
      checkRateLimit();
    
      const url = `${CIVO_API_URL}/instances/${params.id}/stop`;
      const response = await fetch(url, {
        method: 'PUT',
        headers: {
          Authorization: `Bearer ${CIVO_API_KEY}`,
        },
        body: new URLSearchParams({
          region: params.region,
        }),
      });
    
      if (!response.ok) {
        throw new Error(
          `Civo API error: ${response.status} ${response.statusText}`
        );
      }
    
      return response.json();
    }
  • Defines the tool metadata and input schema for 'shutdown_instance'.
    export const SHUTDOWN_INSTANCE_TOOL: Tool = {
      name: 'shutdown_instance',
      description: 'Shutdown a cloud instance on Civo',
      inputSchema: {
        type: 'object',
        properties: {
          id: {
            type: 'string',
            description: 'Instance ID',
          },
          region: {
            type: 'string',
            description: 'Region identifier',
          },
        },
        required: ['id', 'region'],
      },
    };
  • Server-side handler in the CallToolRequest switch that validates inputs, invokes the shutdownInstance function, and returns the formatted response.
    case 'shutdown_instance': {
      if (
        typeof args !== 'object' ||
        args === null ||
        typeof args.id !== 'string' ||
        typeof args.region !== 'string'
      ) {
        throw new Error('Invalid arguments for shutdown_instance');
      }
    
      const result = await shutdownInstance(
        args as { id: string; region: string }
      );
      return {
        content: [
          {
            type: 'text',
            text: `Instance ${args.id} shutdown: ${result.result}`,
          },
        ],
        isError: false,
      };
    }
  • src/index.ts:70-90 (registration)
    Registers all tools including 'shutdown_instance' in the MCP server's capabilities for tool discovery.
    tools: {
      [CREATE_INSTANCE_TOOL.name]: CREATE_INSTANCE_TOOL,
      [LIST_INSTANCES_TOOL.name]: LIST_INSTANCES_TOOL,
      [REBOOT_INSTANCE_TOOL.name]: REBOOT_INSTANCE_TOOL,
      [SHUTDOWN_INSTANCE_TOOL.name]: SHUTDOWN_INSTANCE_TOOL,
      [START_INSTANCE_TOOL.name]: START_INSTANCE_TOOL,
      [RESIZE_INSTANCE_TOOL.name]: RESIZE_INSTANCE_TOOL,
      [DELETE_INSTANCE_TOOL.name]: DELETE_INSTANCE_TOOL,
      [LIST_DISK_IMAGES_TOOL.name]: LIST_DISK_IMAGES_TOOL,
      [GET_DISK_IMAGE_TOOL.name]: GET_DISK_IMAGE_TOOL,
      [LIST_SIZES_TOOL.name]: LIST_SIZES_TOOL,
      [LIST_REGIONS_TOOL.name]: LIST_REGIONS_TOOL,
      [LIST_NETWORKS_TOOL.name]: LIST_NETWORKS_TOOL,
      [CREATE_NETWORK_TOOL.name]: CREATE_NETWORK_TOOL,
      [RENAME_NETWORK_TOOL.name]: RENAME_NETWORK_TOOL,
      [DELETE_NETWORK_TOOL.name]: DELETE_NETWORK_TOOL,
      [LIST_KUBERNETES_CLUSTERS_TOOL.name]: LIST_KUBERNETES_CLUSTERS_TOOL,
      [CREATE_KUBERNETES_CLUSTER_TOOL.name]: CREATE_KUBERNETES_CLUSTER_TOOL,
      [DELETE_KUBERNETES_CLUSTER_TOOL.name]: DELETE_KUBERNETES_CLUSTER_TOOL,
      [LIST_KUBERNETES_VERSIONS_TOOL.name]: LIST_KUBERNETES_VERSIONS_TOOL,
    },

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/tao12345666333/civo-mcp'

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