Skip to main content
Glama

create_instance

Create cloud instances on Civo by specifying hostname, size, and template ID to deploy virtual servers with configurable region and quantity.

Instructions

Create a new cloud instance on Civo

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hostnameYesFully qualified domain name
sizeYesInstance size (e.g. g2.small)
template_idYesDisk image ID
countNoNumber of instances to create
regionNoRegion identifierLON1

Implementation Reference

  • The core handler function that executes the tool logic by making a POST request to the Civo API to create a new instance.
    export async function createInstance(params: { hostname: string; size: string; template_id: string; count?: number; region?: string; }): Promise<CivoInstance> { checkRateLimit(); const url = `${CIVO_API_URL}/instances`; const response = await fetch(url, { method: 'POST', headers: { Authorization: `Bearer ${CIVO_API_KEY}`, 'Content-Type': 'application/x-www-form-urlencoded', }, body: new URLSearchParams({ hostname: params.hostname, size: params.size, template_id: params.template_id, count: params.count?.toString() || '1', region: params.region || 'LON1', }), }); if (!response.ok) { throw new Error( `Civo API error: ${response.status} ${response.statusText}` ); } return response.json(); }
  • Defines the tool metadata, name, description, and input schema for validation.
    export const CREATE_INSTANCE_TOOL: Tool = { name: 'create_instance', description: 'Create a new cloud instance on Civo', inputSchema: { type: 'object', properties: { hostname: { type: 'string', description: 'Fully qualified domain name', }, size: { type: 'string', description: 'Instance size (e.g. g2.small)', }, template_id: { type: 'string', description: 'Disk image ID', }, count: { type: 'number', description: 'Number of instances to create', default: 1, }, region: { type: 'string', description: 'Region identifier', default: 'LON1', }, }, required: ['hostname', 'size', 'template_id'], }, };
  • src/index.ts:71-71 (registration)
    Registers the 'create_instance' tool schema in the MCP server's capabilities.tools object.
    [CREATE_INSTANCE_TOOL.name]: CREATE_INSTANCE_TOOL,
  • The dispatch handler in the main CallToolRequestSchema that validates arguments and calls the createInstance function, returning the response.
    case 'create_instance': { if ( typeof args !== 'object' || args === null || typeof args.hostname !== 'string' || typeof args.size !== 'string' || typeof args.template_id !== 'string' ) { throw new Error('Invalid arguments for create_instance'); } const instance = await createInstance({ hostname: args.hostname as string, size: args.size as string, template_id: args.template_id as string, count: args.count as number | undefined, region: args.region as string | undefined, }); return { content: [ { type: 'text', text: `Created instance ${instance.hostname} (ID: ${instance.id})`, }, ], isError: false, }; }

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