get_vm_nics
Retrieve network interface details for a specific virtual machine in VergeOS virtualization platforms to manage connectivity and monitor network configurations.
Instructions
Get network interfaces for a VM
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | VM ID |
Implementation Reference
- src/index.js:195-204 (handler)Core handler implementation for get_vm_nics tool. Fetches the VM details to obtain machine ID, queries the VergeOS API for machine_nics, filters results, and returns the network interfaces.async getVMNics(vmId) { // Get VM to find machine ID const vm = await this.getVM(vmId); const machineId = vm.machine; const nics = await this.request( `/api/v4/machine_nics?machine=${machineId}&fields=most` ); // Filter to only this machine's NICs (API quirk) return nics.filter((nic) => nic.machine === machineId); }
- src/index.js:336-348 (schema)Input schema definition for the get_vm_nics tool in the TOOLS array, specifying required VM ID parameter.name: "get_vm_nics", description: "Get network interfaces for a VM", inputSchema: { type: "object", properties: { id: { type: "number", description: "VM ID", }, }, required: ["id"], }, },
- src/index.js:557-559 (registration)Dispatch/registration in the tool call handler switch statement, invoking the getVMNics method.case "get_vm_nics": result = await api.getVMNics(args.id); break;
- local-proxy/index-direct.js:170-184 (handler)Alternative handler implementation in direct proxy mode with additional mapping of NIC fields including MAC, IP, etc.async function getVMNics(vmId) { // Get VM to find machine ID const vm = await getVM(vmId); const machineId = vm.machine; const nics = await apiRequest(`/api/v4/machine_nics?machine=${machineId}&fields=all`); return nics.filter(n => n.machine === machineId).map(n => ({ id: n.$key, name: n.name, mac: n.macaddress, network_id: n.vnet, ip: n.ipaddress, interface: n.interface, enabled: n.enabled, })); }
- local-proxy/index-direct.js:366-367 (schema)Schema for get_vm_nics in the direct proxy TOOLS array.{ name: "get_vm_nics", description: "Get VM network interfaces", inputSchema: { type: "object", properties: { id: { type: "number", description: "VM ID" } }, required: ["id"] } }, { name: "get_vm_drives", description: "Get VM disk drives", inputSchema: { type: "object", properties: { id: { type: "number", description: "VM ID" } }, required: ["id"] } },