list_disk_images
Retrieve available disk images for a specified region to select an operating system for Civo cloud instances.
Instructions
List available disk images on Civo
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| region | No | Region identifier |
Implementation Reference
- src/api/disk-images.ts:9-30 (handler)Main handler that calls the Civo API to list disk images, with optional region filtering.
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)Server-side handler in the CallToolRequestSchema that dispatches to the API function and formats the response.
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 name, description, and input schema (accepts optional region string).
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/civo.ts:69-71 (schema)Type definitions for the disk image list response.
export interface CivoDiskImageList { items: CivoDiskImage[]; } - src/index.ts:78-90 (registration)Tool registration in the server capabilities object.
[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, },