create_network
Initiate network creation in CloudStack by defining essential parameters such as name, display text, network offering ID, zone ID, gateway, and netmask for efficient cloud resource management.
Instructions
Create a new network
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| displaytext | Yes | Network display text | |
| gateway | No | Network gateway | |
| name | Yes | Network name | |
| netmask | No | Network netmask | |
| networkofferingid | Yes | Network offering ID | |
| zoneid | Yes | Zone ID |
Implementation Reference
- src/handlers/network-handlers.ts:39-50 (handler)The main handler function that executes the create_network tool logic by calling the CloudStack client and formatting the response.async handleCreateNetwork(args: any) { const result = await this.cloudStackClient.createNetwork(args); return { content: [ { type: 'text', text: `Created network. Job ID: ${result.createnetworkresponse?.jobid}\nNetwork ID: ${result.createnetworkresponse?.id}` } ] }; }
- Defines the tool name, description, and input schema for validation.name: 'create_network', description: 'Create a new network', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Network name', }, displaytext: { type: 'string', description: 'Network display text', }, networkofferingid: { type: 'string', description: 'Network offering ID', }, zoneid: { type: 'string', description: 'Zone ID', }, gateway: { type: 'string', description: 'Network gateway', }, netmask: { type: 'string', description: 'Network netmask', }, }, required: ['name', 'displaytext', 'networkofferingid', 'zoneid'], additionalProperties: false, }, },
- src/server.ts:152-153 (registration)Tool registration in the main server switch statement, dispatching calls to the handler.case 'create_network': return await this.networkHandlers.handleCreateNetwork(args);
- src/cloudstack-client.ts:189-191 (helper)Supporting CloudStack API client method that performs the actual 'createNetwork' API request.async createNetwork(params: CloudStackParams): Promise<CloudStackResponse> { return this.request('createNetwork', params); }