network_action
Manage network operations in VergeOS by powering on, powering off, resetting, or applying configurations to networks using their ID.
Instructions
Perform an action on a network (poweron, poweroff, reset, apply)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Network ID | |
| action | Yes | Action to perform |
Implementation Reference
- src/index.js:146-152 (handler)The core handler function in the VergeOSAPI class that executes the network action by making a POST request to the VergeOS API endpoint /api/v4/vnet_actions with the network ID and action.async networkAction(id, action) { return this.request("/api/v4/vnet_actions", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ vnet: id, action }), }); }
- src/index.js:388-406 (schema)The input schema definition for the network_action tool, including parameters id (number) and action (string enum). This is part of the TOOLS array returned by list_tools.name: "network_action", description: "Perform an action on a network (poweron, poweroff, reset, apply)", inputSchema: { type: "object", properties: { id: { type: "number", description: "Network ID", }, action: { type: "string", enum: ["poweron", "poweroff", "reset", "apply", "applydns"], description: "Action to perform", }, }, required: ["id", "action"], }, },
- src/index.js:571-573 (registration)The registration and dispatch logic in the switch statement handling CallToolRequestSchema, which calls the networkAction handler when the tool is invoked.case "network_action": result = await api.networkAction(args.id, args.action); break;