Skip to main content
Glama
tao12345666333

Civo MCP Server

get_disk_image

Retrieve detailed information about a specific disk image from the Civo cloud platform using its ID and optional region identifier.

Instructions

Get details of a specific disk image

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesDisk image ID
regionNoRegion identifier

Implementation Reference

  • Core handler function that executes the get_disk_image tool logic by making an API request to Civo to retrieve disk image details.
    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();
    }
  • Schema definition for the get_disk_image tool, including input validation schema, description, and name.
    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-79 (registration)
    Registers the get_disk_image tool schema in the MCP server's capabilities.tools dictionary.
    [GET_DISK_IMAGE_TOOL.name]: GET_DISK_IMAGE_TOOL,
  • MCP server dispatch handler for get_disk_image tool calls: validates input, calls the core getDiskImage function, and formats the response text.
    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,
      };
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tao12345666333/civo-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server