shutdown_instance
Shutdown a cloud instance on Civo by providing the instance ID and region identifier to stop running virtual machines and manage cloud resources.
Instructions
Shutdown a cloud instance on Civo
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Instance ID | |
| region | Yes | Region identifier |
Implementation Reference
- src/index.ts:255-277 (handler)MCP server handler for the 'shutdown_instance' tool. Validates input arguments and calls the underlying shutdownInstance API function to execute the shutdown.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/tools/instances.ts:79-96 (schema)Defines the Tool object for 'shutdown_instance', including name, description, and input schema for validation.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'], }, };
- src/api/instances.ts:97-121 (helper)Core helper function that sends PUT request to 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(); }
- src/index.ts:74-75 (registration)Registers the shutdown_instance tool in the MCP server's capabilities.tools dictionary.[SHUTDOWN_INSTANCE_TOOL.name]: SHUTDOWN_INSTANCE_TOOL, [START_INSTANCE_TOOL.name]: START_INSTANCE_TOOL,