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
| Name | Required | Description | Default |
|---|---|---|---|
| label | Yes | Network label | |
| region | No | Region identifier |
Implementation Reference
- src/index.ts:379-400 (handler)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, }; }
- src/api/networks.ts:27-46 (helper)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(); }
- src/tools/networks.ts:12-29 (schema)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,