Skip to main content
Glama
tao12345666333

Civo MCP Server

create_network

Create a new network on Civo cloud platform by specifying a label and region to organize and connect cloud resources.

Instructions

Create a new network on Civo

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
labelYesNetwork label
regionNoRegion identifier

Implementation Reference

  • Tool handler in the CallToolRequestSchema switch statement. Validates input arguments matching the schema, calls the createNetwork API function, and returns a formatted success response with the created network details.
    case 'create_network': {
      if (
        typeof args !== 'object' ||
        args === null ||
        typeof args.label !== 'string'
      ) {
        throw new Error('Invalid arguments for create_network');
      }
    
      const network = await createNetwork(
        args as { label: string; region?: string }
      );
      return {
        content: [
          {
            type: 'text',
            text: `Created network ${network.label} (ID: ${network.id})`,
          },
        ],
        isError: false,
      };
    }
  • Core API helper function that performs the HTTP POST request to the Civo API to create a new network.
    export async function createNetwork(params: {
      label: string;
      region?: string;
    }): Promise<any> {
      const url = `${CIVO_API_URL}/networks`;
      const response = await fetch(url, {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          Authorization: `Bearer ${CIVO_API_KEY}`,
        },
        body: JSON.stringify(params),
      });
    
      if (!response.ok) {
        throw new Error(`Failed to create network: ${response.statusText}`);
      }
    
      return await response.json();
    }
  • Tool definition object providing the schema for input validation, description, and name registration.
    export const CREATE_NETWORK_TOOL: Tool = {
      name: 'create_network',
      description: 'Create a new network on Civo',
      inputSchema: {
        type: 'object',
        properties: {
          label: {
            type: 'string',
            description: 'Network label',
          },
          region: {
            type: 'string',
            description: 'Region identifier',
          },
        },
        required: ['label'],
      },
    };
  • src/index.ts:83-83 (registration)
    Registers the create_network tool in the server's capabilities.tools map for MCP protocol.
    [CREATE_NETWORK_TOOL.name]: CREATE_NETWORK_TOOL,

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