resize_instance
Change the size of a cloud instance on Civo to adjust computing resources like CPU and memory by specifying the instance ID, new size, and region.
Instructions
Resize a cloud instance on Civo
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Instance ID | |
| region | Yes | Region identifier | |
| size | Yes | New instance size |
Implementation Reference
- src/api/instances.ts:149-176 (handler)The resizeInstance function that executes the core tool logic by calling the Civo API to resize the instance.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(); }
- src/tools/instances.ts:117-138 (schema)Tool schema definition including input schema, name, and description 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:303-326 (registration)Dispatch handler in the CallToolRequestSchema that validates arguments and calls resizeInstance for the resize_instance tool.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, }; }
- src/index.ts:76-76 (registration)Registration of the resize_instance tool in the server capabilities.tools object.[RESIZE_INSTANCE_TOOL.name]: RESIZE_INSTANCE_TOOL,