get_disk_image
Retrieve details of a specific disk image by providing its ID and optionally a region identifier.
Instructions
Get details of a specific disk image
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Disk image ID | |
| region | No | Region identifier |
Implementation Reference
- src/tools/disk-images.ts:17-34 (schema)Tool schema registration for 'get_disk_image' - defines name, description, and input schema (id required, region optional).
export const GET_DISK_IMAGE_TOOL: Tool = { name: 'get_disk_image', description: 'Get details of a specific disk image', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Disk image ID', }, region: { type: 'string', description: 'Region identifier', }, }, required: ['id'], }, }; - src/index.ts:79-93 (registration)Tool registration - maps GET_DISK_IMAGE_TOOL.name to the tool definition in the server's capabilities.
[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, }, }, } ); - src/index.ts:106-118 (registration)Lists GET_DISK_IMAGE_TOOL in the ListToolsRequestSchema handler so it's exposed to clients.
GET_DISK_IMAGE_TOOL, LIST_SIZES_TOOL, LIST_REGIONS_TOOL, LIST_NETWORKS_TOOL, CREATE_NETWORK_TOOL, RENAME_NETWORK_TOOL, DELETE_NETWORK_TOOL, LIST_KUBERNETES_CLUSTERS_TOOL, CREATE_KUBERNETES_CLUSTER_TOOL, DELETE_KUBERNETES_CLUSTER_TOOL, LIST_KUBERNETES_VERSIONS_TOOL, ], })); - src/index.ts:198-229 (handler)Call handler for 'get_disk_image' - validates args (id must be string), calls getDiskImage API function, formats response with image details.
case 'get_disk_image': { if ( typeof args !== 'object' || args === null || typeof args.id !== 'string' ) { throw new Error('Invalid arguments for get_disk_image'); } const image = await getDiskImage({ id: args.id as string, region: args.region as string, }); return { content: [ { type: 'text', text: 'Disk Image Details:\n' + `ID: ${image.id}\n` + `Name: ${image.name}\n` + `Version: ${image.version}\n` + `State: ${image.state}\n` + `Distribution: ${image.distribution}\n` + `Description: ${image.description || 'None'}\n` + `Label: ${image.label || 'None'}`, }, ], isError: false, }; } - src/api/disk-images.ts:32-54 (helper)API helper function getDiskImage - makes HTTP GET request to Civo API /v2/disk_images/{id} with region parameter, returns parsed JSON as CivoDiskImage.
export async function getDiskImage(params: { id: string; region: string; }): Promise<CivoDiskImage> { checkRateLimit(); const url = new URL(`${CIVO_API_URL}/disk_images/${params.id}`); 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 response.json(); }