A Nu package is an npm package or Git repository with a nu key in its
package.json:
client.commands adds slash commands. Each has a description and a
message, which Nu receives as if you sent it, with {args} replaced by the
text after the command. client.tools sets how the terminal shows a tool’s
calls: an icon, a title with {argument} placeholders, and a body that
names an argument to show as code in its language.
The nu-package keyword lists an npm package in nu search. Types for tools
and extensions come from @rebuno/nu-types:
Nu’s repository has example packages
for tools, skills, and chat channels.
A tool is a manifest and a module:
The default export takes the call’s arguments and returns its result. The
second argument holds the package’s settings as config.
Nu bundles each tool with everything it imports when it installs the package.
Tools can share code in the package and use npm packages from its
dependencies, as long as every import stays inside the package. A tool needs
a higher version whenever its code or anything it imports changes. Every call
runs the bundle in a fresh process that can’t read other files. It sees the
secrets in secrets as environment variables.
Set idempotency to safe_to_retry if running a call twice does no harm. Use
at_most_once for anything that shouldn’t repeat, like sending an email. If Nu
crashes in the middle of such a call, it waits for you instead of running it
again.
To return images or audio, return { content: [...] } in the same shape MCP
tools use. Nu saves the files under ~/.nu/workspace/tools/.
Extensions
An extension is a module that runs inside Nu. Its default export gets the
extension API:
nu.config holds the package’s settings, and nu.secret(name) reads one of
the secrets listed in its secrets.
Extensions run with Nu’s own access, unlike tools. Only install ones you
trust.
turn_end and tool_execution_end are delivered once. If a handler fails, Nu
logs the error and moves on.
Nu restarts its services when an extension is installed or removed, or when its
settings or secrets change. Running turns carry on afterwards. nu reload
restarts them by hand.