Skip to main content
Glama
tao12345666333

Civo MCP Server

resize_instance

Change the size of a cloud instance on Civo to adjust computing resources. Specify the instance ID, new size, and region to complete the resize operation.

Instructions

Resize a cloud instance on Civo

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesInstance ID
sizeYesNew instance size
regionYesRegion identifier

Implementation Reference

  • MCP server tool handler for 'resize_instance': validates arguments and invokes resizeInstance API function, returning success response.
    case 'resize_instance': {
      if (
        typeof args !== 'object' ||
        args === null ||
        typeof args.id !== 'string' ||
        typeof args.size !== 'string' ||
        typeof args.region !== 'string'
      ) {
        throw new Error('Invalid arguments for resize_instance');
      }
    
      const result = await resizeInstance(
        args as { id: string; size: string; region: string }
      );
      return {
        content: [
          {
            type: 'text',
            text: `Instance ${args.id} resized: ${result.result}`,
          },
        ],
        isError: false,
      };
    }
  • Implements the resize instance logic by sending a PUT request to Civo API's resize endpoint.
    export async function resizeInstance(params: {
      id: string;
      size: string;
      region: string;
    }): Promise<any> {
      checkRateLimit();
    
      const url = new URL(`${CIVO_API_URL}/instances/${params.id}/resize`);
      url.searchParams.set('region', params.region);
    
      const response = await fetch(url.toString(), {
        method: 'PUT',
        headers: {
          Authorization: `Bearer ${CIVO_API_KEY}`,
        },
        body: new URLSearchParams({
          size: params.size,
        }),
      });
    
      if (!response.ok) {
        throw new Error(
          `Civo API error: ${response.status} ${response.statusText}`
        );
      }
    
      return response.json();
    }
  • Defines the Tool specification including input schema for resize_instance.
    export const RESIZE_INSTANCE_TOOL: Tool = {
      name: 'resize_instance',
      description: 'Resize a cloud instance on Civo',
      inputSchema: {
        type: 'object',
        properties: {
          id: {
            type: 'string',
            description: 'Instance ID',
          },
          size: {
            type: 'string',
            description: 'New instance size',
          },
          region: {
            type: 'string',
            description: 'Region identifier',
          },
        },
        required: ['id', 'size', 'region'],
      },
    };
  • src/index.ts:76-76 (registration)
    Registers the resize_instance tool in the MCP server's capabilities.tools dictionary.
    [RESIZE_INSTANCE_TOOL.name]: RESIZE_INSTANCE_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