chatjs add.
This is the extension surface for ChatJS. Built-in product tools stay in tools/platform. Installable tools live in tools/chatjs and are managed by the CLI.
What You Install
When you runchatjs add, the CLI:
- Fetches a registry item by name
- Resolves any registry dependencies that item depends on
- Writes the tool files into the installable tools directory from
chat.config.ts - Installs any npm dependencies declared by the registry item
- Warns if installed items declare missing environment variables
- Updates the CLI-managed registry files so the tool is available to the model and renderer
Why This Exists
The registry gives ChatJS a standardized way to distribute software between projects.- You can publish self-contained tools instead of copying app-specific code by hand.
- Installed tools become part of the app’s typed tool system automatically.
- Each tool can ship both execution logic and a custom UI renderer.
- Shared helpers can be distributed as registry dependencies and installed alongside the main tool.
shadcn/ui, the model is similar. The registry distributes source files into your project instead of mounting opaque runtime plugins.
Installed Tool Layout
By default, installed tools are written intotools/chatjs:
tools/chatjs/tools.ts and tools/chatjs/ui.ts are the CLI-managed registry files. You should not edit them manually.
Registry Boundaries
ChatJS separates tools into two layers:| Location | Ownership | Purpose |
|---|---|---|
tools/platform | ChatJS platform | Built-in product tools and tightly coupled internal tooling |
tools/chatjs | Registry + app | Installable tools distributed through chatjs add |
tools/platform when a tool depends on internal app contracts or product infrastructure.
Use tools/chatjs when a tool should be portable across ChatJS projects as a distributable package.
Project Configuration
The registry installs files into the path configured bypaths.tools in chat.config.ts:
chat.config.ts
Tool Environment Variables
Installable tools can declare their own environment requirements directly intool.ts.
tools/chatjs/retrieve-url/tool.ts
toolEnvVars into the generated registry manifest as envRequirements. chatjs add uses that metadata for install-time warnings, and check-env validates installed tools from their tool.ts source at app startup and build time.
Using a Different Registry
You can point the CLI at a local or custom registry:CHATJS_REGISTRY_URL.
Manual Update And Troubleshooting
- Re-running
chatjs addis safe. The CLI avoids duplicate registry entries. - Pass
--overwriteif you want to replace existing installed files. - If
chat.config.tsis missing,chatjs addwill stop before making changes. - If an item declares shared registry dependencies, those are installed automatically before the main item is registered.
- If the registry index does not exist yet, the CLI creates it for you.
Related
- CLI add for the command reference
- Adding Tools for how installation works under the hood
- Tools for authoring and publishing registry tools