list_disk_images
Retrieve available disk images from the Civo cloud platform to identify operating systems and application templates for creating new cloud instances.
Instructions
List available disk images on Civo
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| region | No | Region identifier |
Implementation Reference
- src/index.ts:178-196 (handler)MCP server request handler for the 'list_disk_images' tool. It calls the listDiskImages API function, formats the list of disk images into a text response, and returns it.case 'list_disk_images': { const images = await listDiskImages(args); const imageList = images.items .map( i => `${i.name} (${i.id}) - ${i.distribution} ${i.version} - ${i.state}` ) .join('\n'); return { content: [ { type: 'text', text: `Disk Images:\n${imageList}`, }, ], isError: false, }; }
- src/tools/disk-images.ts:3-15 (schema)Tool definition object including name, description, and inputSchema for validating tool inputs.export const LIST_DISK_IMAGES_TOOL: Tool = { name: 'list_disk_images', description: 'List available disk images on Civo', inputSchema: { type: 'object', properties: { region: { type: 'string', description: 'Region identifier', }, }, }, };
- src/api/disk-images.ts:9-30 (helper)Underlying API function that performs the HTTP request to Civo's disk_images endpoint to retrieve the list of disk images.export async function listDiskImages(params: { region?: string; }): Promise<CivoDiskImageList> { checkRateLimit(); const url = new URL(`${CIVO_API_URL}/disk_images`); if (params.region) url.searchParams.set('region', params.region); const response = await fetch(url.toString(), { headers: { Authorization: `Bearer ${CIVO_API_KEY}`, }, }); if (!response.ok) { throw new Error( `Civo API error: ${response.status} ${response.statusText}` ); } return { items: await response.json() }; }
- src/index.ts:78-78 (registration)Registration of the tool in the server's capabilities dictionary.[LIST_DISK_IMAGES_TOOL.name]: LIST_DISK_IMAGES_TOOL,
- src/index.ts:105-105 (registration)Inclusion of the tool in the ListTools response.LIST_DISK_IMAGES_TOOL,