There is no scripting support to create a tool, you'd need a C++ plugin.
Tool manager requires several configuration settings which can only be supplied during startup (icon, tool type, should it get added as sub-tool, is it about selection or creation, associated key).
A typical tool also introduces a new mouse cursor (separate resources) and associated trackers (e.g. working differently over a text window or specific page items), may be repeatedly called while you move the mouse (dynamic command), cause interactions with the touched areas (temporarily draw dedicated adornments - e.g. those handles and other highlights) or on top of them (draw sprites), have to handle scrolling (maintain active page), establish an own selection or influence the existing one, even be reflected in some larger panels such as the control strip or the info panel.
All doable with a plugin - actually above describes my first plugin, you could even trigger a script event on many occasions, but it would still be wired to a specific use scenario.
how? any examples to create an HTML extension to add an icon to the non-tools bar.