vpc_create
Create a Virtual Private Cloud (VPC) on Alibaba Cloud by specifying a CIDR block, region, and name for isolated network resources.
Instructions
Create a Virtual Private Cloud (VPC).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| regionId | No | ||
| cidrBlock | Yes | e.g. 192.168.0.0/16 | |
| vpcName | No |
Implementation Reference
- src/tools/vpc/index.ts:18-30 (registration)Registration of the vpc_create tool with its name, description, and inputSchema defining parameters: regionId, cidrBlock (required), vpcName.
{ name: "vpc_create", description: "Create a Virtual Private Cloud (VPC).", inputSchema: { type: "object", properties: { regionId: { type: "string" }, cidrBlock: { type: "string", description: "e.g. 192.168.0.0/16" }, vpcName: { type: "string" } }, required: ["cidrBlock"] } } - src/tools/vpc/index.ts:54-65 (handler)Handler function that executes vpc_create logic: parses input with Zod, constructs CreateVpc API params, and calls the Alibaba Cloud VPC API (CreateVpc).
if (name === "vpc_create") { const parsed = z.object({ regionId: z.string().default(config.ALIBABA_CLOUD_REGION_ID), cidrBlock: z.string(), vpcName: z.string().optional() }).parse(args); const params: any = { RegionId: parsed.regionId, CidrBlock: parsed.cidrBlock }; if (parsed.vpcName) params.VpcName = parsed.vpcName; return { content: [{ type: "text", text: JSON.stringify(await client.request('CreateVpc', params, requestOption), null, 2) }] }; } - src/tools/vpc/index.ts:21-29 (schema)Input schema definition for vpc_create tool using JSON Schema format with properties: regionId, cidrBlock (required, described example), vpcName.
inputSchema: { type: "object", properties: { regionId: { type: "string" }, cidrBlock: { type: "string", description: "e.g. 192.168.0.0/16" }, vpcName: { type: "string" } }, required: ["cidrBlock"] } - src/index.ts:31-43 (registration)Top-level server registration: registerVpcTools() is called in ListToolsRequestSchema handler to provide the vpc_create tool definition.
server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ ...registerUniversalTool(), ...registerEcsTools(), ...registerVpcTools(), ...registerRdsTools(), ...registerRamTools(), ...registerAckTools(), ...registerSlbTools() ], }; }); - src/lib/client.ts:4-12 (helper)Helper utility createRpcClient is available but not directly used in vpc/index.ts - instead the VPC handler creates its own Core.default client directly.
export function createRpcClient(endpoint: string, apiVersion: string) { // @ts-ignore return new Core.default({ accessKeyId: config.ALIBABA_CLOUD_ACCESS_KEY_ID, accessKeySecret: config.ALIBABA_CLOUD_ACCESS_KEY_SECRET, endpoint, apiVersion, }); }