reboot_instance
Restart a Civo cloud instance by providing its ID and region to resolve issues or apply updates.
Instructions
Reboot a cloud instance on Civo
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Instance ID | |
| region | Yes | Region identifier |
Implementation Reference
- src/api/instances.ts:71-95 (handler)The actual API handler function that sends a POST request to the Civo API to reboot an instance. It accepts { id, region } parameters, calls the Civo API endpoint /v2/instances/{id}/reboots, and returns the JSON response.
export async function rebootInstance(params: { id: string; region: string; }): Promise<any> { checkRateLimit(); const url = `${CIVO_API_URL}/instances/${params.id}/reboots`; const response = await fetch(url, { method: 'POST', 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(); } - src/tools/instances.ts:60-77 (schema)The tool schema definition for 'reboot_instance'. Defines inputSchema with required 'id' (string) and 'region' (string) properties, and a description explaining it reboots a cloud instance on Civo.
export const REBOOT_INSTANCE_TOOL: Tool = { name: 'reboot_instance', description: 'Reboot a cloud instance on Civo', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Instance ID', }, region: { type: 'string', description: 'Region identifier', }, }, required: ['id', 'region'], }, }; - src/index.ts:63-93 (registration)Server registration: REBOOT_INSTANCE_TOOL is registered in the server's tool capabilities, making it available for listing and calling via MCP.
const server = new Server( { name: 'example-servers/civo', version: '0.1.0', }, { capabilities: { 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, }, }, } ); - src/index.ts:96-118 (registration)ListTools handler: REBOOT_INSTANCE_TOOL is included in the array of tools returned when clients list available tools.
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ CREATE_INSTANCE_TOOL, LIST_INSTANCES_TOOL, REBOOT_INSTANCE_TOOL, SHUTDOWN_INSTANCE_TOOL, START_INSTANCE_TOOL, RESIZE_INSTANCE_TOOL, DELETE_INSTANCE_TOOL, LIST_DISK_IMAGES_TOOL, GET_DISK_IMAGE_TOOL, LIST_SIZES_TOOL, LIST_REGIONS_TOOL, LIST_NETWORKS_TOOL, CREATE_NETWORK_TOOL, RENAME_NETWORK_TOOL, DELETE_NETWORK_TOOL, LIST_KUBERNETES_CLUSTERS_TOOL, CREATE_KUBERNETES_CLUSTER_TOOL, DELETE_KUBERNETES_CLUSTER_TOOL, LIST_KUBERNETES_VERSIONS_TOOL, ], })); - src/index.ts:231-253 (handler)CallToolRequestHandler case 'reboot_instance': validates that args has id (string) and region (string), calls the rebootInstance API function, and returns a success message with the result.
case 'reboot_instance': { if ( typeof args !== 'object' || args === null || typeof args.id !== 'string' || typeof args.region !== 'string' ) { throw new Error('Invalid arguments for reboot_instance'); } const result = await rebootInstance( args as { id: string; region: string } ); return { content: [ { type: 'text', text: `Instance ${args.id} rebooted: ${result.result}`, }, ], isError: false, }; }