list_disk_images
Retrieve available disk images on Civo cloud platform to select appropriate operating systems or templates for cloud instances.
Instructions
List available disk images on Civo
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| region | No | Region identifier |
Implementation Reference
- src/api/disk-images.ts:9-30 (handler)Core handler function that performs the HTTP request to Civo API to list 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:178-196 (handler)MCP server handler for 'list_disk_images' tool that calls the API function and formats the response for the client.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 schema definition with input schema for the list_disk_images tool.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/index.ts:78-78 (registration)Registration of the list_disk_images tool in the server capabilities.tools dictionary.[LIST_DISK_IMAGES_TOOL.name]: LIST_DISK_IMAGES_TOOL,
- src/index.ts:105-105 (registration)Inclusion of the tool in the ListToolsRequestHandler response array.LIST_DISK_IMAGES_TOOL,