Skip to main content
The factory registry stores builders that construct tool instances from config — use it when you have “here’s how to build this tool from user config”, not “I already have my tool”.
Two registries, two jobs. The factory registry (this page) builds instances from config. The name-keyed registry stores tools by name — use register_tool for “I already have my tool” (see Custom Tools). Reach for registerToolFactory for “here’s how to build this tool from user config”.

Quick Start

1

Register a Factory

2

Build an Instance


Migration from the Old Root Exports

Before PR #4902, register_tool / get_tool / validate_tool at the package root pointed at the factory registry by accident. They now point at the name-keyed registry. If you actually wanted the factory registry, switch names:
The old snake_case aliases (register_tool, get_tool, validate_tool) still exist on the deprecated subpath praisonai/tools/registry, bound to the factory registry. They are @deprecated — prefer the new names.

Building Instances

Two builders, differing only in how they report a missing id.
See Tool Errors for the try/catch pattern that tells “missing” apart from “broken”.

Pre-flight Checks

validateToolInstall(id) reports whether a registered tool’s npm dependency and required environment variables are in place — ideal for CLIs and setup scripts.
validateToolInstall(id) (factory registry) is not validate_tool(tool). The name-keyed validate_tool takes a tool object and throws ToolValidationError on a malformed tool — see Custom Tools.

Registry API

Access the singleton for advanced use cases.

Best Practices

If you already hold a tool instance or function, register_tool on the name-keyed registry is simpler. The factory registry earns its keep when a tool is built from user config or a lazy-loaded dependency.
Return null for a missing id instead of catching an exception — but still let ToolConstructionError surface, so a broken tool never looks identical to a missing one.
Call it before first use in a CLI or bootstrap step so users get a clear “run npm install …” or “set SEARCH_API_KEY” message instead of a runtime failure.
Replace praisonai/tools/registry snake_case imports with registerToolFactory / createToolInstance / tryCreateToolInstance / validateToolInstall.

Custom Tools

Name-keyed registry & FunctionTool

Tool Errors

Missing vs broken tools

Tools Registry

Built-in AI SDK tools

Tool System

Tools overview