Skip to main content
Glama
tao12345666333

Civo MCP Server

rename_network

Change the name of an existing network in Civo cloud platform by specifying its ID and new label. Update network identifiers for better organization and management.

Instructions

Rename a network on Civo

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesNetwork ID
labelYesNew network label
regionNoRegion identifier

Implementation Reference

  • Executes the rename_network tool by validating arguments and calling the renameNetwork API function, returning a success message.
    case 'rename_network': {
      if (
        typeof args !== 'object' ||
        args === null ||
        typeof args.id !== 'string' ||
        typeof args.label !== 'string'
      ) {
        throw new Error('Invalid arguments for rename_network');
      }
    
      const network = await renameNetwork(
        args as { id: string; label: string; region?: string }
      );
      return {
        content: [
          {
            type: 'text',
            text: `Renamed network ${network.id} to ${network.label}`,
          },
        ],
        isError: false,
      };
    }
  • Defines the input schema, name, and description for the rename_network tool.
    export const RENAME_NETWORK_TOOL: Tool = {
      name: 'rename_network',
      description: 'Rename a network on Civo',
      inputSchema: {
        type: 'object',
        properties: {
          id: {
            type: 'string',
            description: 'Network ID',
          },
          label: {
            type: 'string',
            description: 'New network label',
          },
          region: {
            type: 'string',
            description: 'Region identifier',
          },
        },
        required: ['id', 'label'],
      },
    };
  • src/index.ts:84-84 (registration)
    Registers the rename_network tool in the MCP server capabilities.tools object.
    [RENAME_NETWORK_TOOL.name]: RENAME_NETWORK_TOOL,
  • Implements the core logic for renaming a network by making a PUT request to the Civo API.
    export async function renameNetwork(params: {
      id: string;
      label: string;
      region?: string;
    }): Promise<any> {
      const url = `${CIVO_API_URL}/networks/${params.id}`;
      const response = await fetch(url, {
        method: 'PUT',
        headers: {
          'Content-Type': 'application/json',
          Authorization: `Bearer ${CIVO_API_KEY}`,
        },
        body: JSON.stringify({ label: params.label, region: params.region }),
      });
    
      if (!response.ok) {
        throw new Error(`Failed to rename network: ${response.statusText}`);
      }
    
      return await response.json();
    }

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