toolboxTool Registry

A centralized registry for discovering, registering, and resolving AI tools across modules and classes.

circle-info

Since BoxLang AI v3.0+

The Tool Registry is a singleton that manages AI tools across your entire application. Instead of manually passing tool arrays to every agent, you can register tools once and resolve them by name anywhere.

Why Use the Registry?

Without Registry
With Registry

Pass tools array to every agent/model call

Register once, reference by name

No cross-module tool sharing

Tools shared across modules

Manual @AITool discovery

Auto-scan classes for annotated methods

Duplicate tool definitions

Single source of truth

Accessing the Registry

// Get the singleton registry
registry = aiToolRegistry()

Registering Tools

From an ITool Instance

myTool = aiTool( "search", "Search the database", ( query ) => db.search( query ) )
aiToolRegistry().register( myTool )

Shorthand Registration

With Module Attribution

Use a module name to group tools for easy bulk unregistration later:

Scanning a Class with @AITool

Annotate methods with @AITool and scan the class to register all at once:

Scanning a Package Path

Using Registered Tools

Resolve by Name

Resolve an Array (Mix of Strings and Instances)

resolveTools() lets you pass a heterogeneous array of tool names and/or ITool instances:

Introspect the Registry

Unregistering Tools

Last updated