tooluniverse.tool_registry module¶
Simplified tool registry for automatic tool discovery and registration.
Record tool failure.
- tooluniverse.tool_registry.register_tool(tool_type_name=None, config=None)[source]¶
Decorator to automatically register tool classes and their configs.
- Usage:
@register_tool(‘CustomToolName’, config={…}) class MyTool:
pass
- tooluniverse.tool_registry.register_external_tool(tool_name, tool_class)[source]¶
Allow external registration of tool classes.
- tooluniverse.tool_registry.register_config(tool_type_name, config)[source]¶
Register a config for a tool type.
- tooluniverse.tool_registry.get_config_registry()[source]¶
Get a copy of the current config registry.
- tooluniverse.tool_registry.register_tool_configs(configs)[source]¶
Register a list of tool configs from a sub-package (e.g. tooluniverse-circuit).
Sub-package
__init__.pyfiles call this to make their JSON configs discoverable byToolUniverse.load_tools()without requiring any entries indefault_config.py.- Parameters:
configs (list) – List of tool config dicts, each containing at least a
namekey.
- tooluniverse.tool_registry.get_list_config_registry()[source]¶
Return the flat list of configs registered by sub-packages.
- tooluniverse.tool_registry.clear_lazy_cache()[source]¶
Clear the module-level lazy import cache.
Built-in tool modules (in
src/tooluniverse/tools/) are cached after their first import. Call this function in development environments when you have edited a built-in tool module and want the changes to take effect without restarting the process. After calling this, the next access to the tool will re-import its module from disk.Note: this does NOT affect workspace user tool files; those are handled separately via mtime tracking in
_import_user_python_tools().Example:
from tooluniverse.tool_registry import clear_lazy_cache clear_lazy_cache() tu.refresh_tools()
- tooluniverse.tool_registry.lazy_import_tool(tool_name)[source]¶
Lazily import a tool by name without importing all tool modules. Only imports the specific module containing the requested tool.
- tooluniverse.tool_registry.build_lazy_registry(package_name=None)[source]¶
Build a mapping of tool names to module names. Prioritizes pre-computed static registry (for bundles/frozen envs). Falls back to AST analysis if static registry is missing.
- tooluniverse.tool_registry.reset_plugin_discovery()[source]¶
Clear the set of already-discovered plugin names.
Call this before
build_lazy_registry()(orrefresh_tools()) when a new plugin package has been installed in the current process and you want_discover_entry_point_plugins()to pick it up without restarting.