For the complete documentation index, see llms.txt. This page is also available as Markdown.

aiToolRegistry

Returns the singleton AIToolRegistry instance for registering, discovering, and resolving AI tools globally.

Returns the singleton AIToolRegistry instance for registering, discovering, and resolving AI tools globally.

Syntax

aiToolRegistry()

Parameters

No parameters.

Returns

Returns the singleton AIToolRegistry instance. The same registry instance is returned on every call within a runtime.

Examples

Register a Tool

aiToolRegistry().register(
    name       : "getWeather",
    description: "Get current weather for a location",
    callback   : ( location ) => weatherService.fetch( location )
)

Register with Module Attribution

Scan a Class for @AITool Annotations

Scan a Package Path

Resolve Tools for an Agent

Check and Retrieve Tools

Unregister Tools

Registry API Reference

Method
Description

register( item, module, name, description, callback )

Register an ITool instance or closure

scan( pathOrInstance, module )

Scan class or package for @AITool annotations

scanClass( instance, module )

Scan a single class instance

get( key )

Retrieve a tool by key

has( key )

Check if a key exists

keys()

Return all registered keys

listTools()

Return all registered ITool instances

getToolInfo( key )

Return name and description info for a key

resolveTools( array )

Resolve an array of keys and/or instances to ITool[]

unregister( key )

Remove a tool by key

unregisterByModule( module )

Remove all tools registered under a module name

  • Tool Registry — Full registry documentation

  • Custom Tools — Building custom tool classes

  • aiTool() — Create ITool instances

Last updated