delete_lab_network
Permanently removes a specified network from a lab in EVE-NG, terminating all its connections. Requires lab path and network ID. This action is irreversible.
Instructions
Delete a network from a lab.
This tool permanently removes a network from the lab. All connections to this network will be lost. This action cannot be undone.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| arguments | Yes |
Implementation Reference
- MCP tool handler for 'delete_lab_network'. Validates input using DeleteNetworkArgs, checks connection, calls EVENGClientWrapper.delete_lab_network, handles success/error, returns TextContent list.@mcp.tool() async def delete_lab_network(arguments: DeleteNetworkArgs) -> list[TextContent]: """ Delete a network from a lab. This tool permanently removes a network from the lab. All connections to this network will be lost. This action cannot be undone. """ try: logger.info(f"Deleting network {arguments.network_id} from {arguments.lab_path}") if not eveng_client.is_connected: return [TextContent( type="text", text="Not connected to EVE-NG server. Use connect_eveng_server tool first." )] # Delete network result = await eveng_client.delete_lab_network(arguments.lab_path, int(arguments.network_id)) if result.get('status') == 'success': return [TextContent( type="text", text=f"Successfully deleted network {arguments.network_id} from {arguments.lab_path}\n\n" f"⚠️ The network has been permanently removed from the lab.\n" f"All connections to this network have been lost.\n" f"This action cannot be undone." )] else: return [TextContent( type="text", text=f"Failed to delete network: {result.get('message', 'Unknown error')}" )] except Exception as e: logger.error(f"Failed to delete network: {e}") return [TextContent( type="text", text=f"Failed to delete network: {str(e)}" )]
- Pydantic schema for tool inputs: lab_path (str) and network_id (str).class DeleteNetworkArgs(BaseModel): """Arguments for delete_network tool.""" lab_path: str = Field(description="Full path to the lab (e.g., /lab_name.unl)") network_id: str = Field(description="Network ID to delete")
- Helper method in EVENGClientWrapper that calls the EVE-NG API to delete a lab network, with connection check and error handling.async def delete_lab_network(self, lab_path: str, net_id: int) -> Dict[str, Any]: """Delete a network from a lab.""" await self.ensure_connected() try: result = await asyncio.to_thread(self.api.delete_lab_network, lab_path, net_id) self.logger.info("Deleted lab network", lab_path=lab_path, net_id=net_id) return result except Exception as e: self.logger.error("Failed to delete lab network", **log_error(e, {"lab_path": lab_path, "net_id": net_id})) raise EVENGAPIError(f"Failed to delete lab network: {str(e)}")
- eveng_mcp_server/server.py:53-53 (registration)Top-level registration call in EVENGMCPServer._register_components() that registers all tools, including delete_lab_network via tools.__init__.register_tools -> network_management.register_network_tools.register_tools(self.mcp, self.eveng_client)
- eveng_mcp_server/tools/__init__.py:28-28 (registration)Intermediate registration call in tools.register_tools() specifically for network tools, which defines and registers the delete_lab_network handler.register_network_tools(mcp, eveng_client)