From b5e13bcd8ab8f436f751684817201f1e4a326223 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Mon, 15 Jun 2026 00:02:31 +0200 Subject: [PATCH] docs(coding-agent): clarify active tools docs closes #5729 --- packages/coding-agent/CHANGELOG.md | 1 + packages/coding-agent/docs/extensions.md | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index 6e63d2f2..6afe9ad9 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -8,6 +8,7 @@ ### Fixed +- Fixed extensions documentation to clarify that `pi.getActiveTools()` returns active tool names while `pi.getAllTools()` returns tool metadata ([#5729](https://github.com/earendil-works/pi/issues/5729)). - Fixed package commands such as `pi list`, `pi install`, and `pi update` to terminate after completing even if an extension leaves background handles open ([#5687](https://github.com/earendil-works/pi/issues/5687)). - Fixed `pi update` for pnpm global installs whose configured `global-bin-dir` no longer matches the active pnpm home ([#5689](https://github.com/earendil-works/pi/issues/5689)). - Fixed npm package specs that use ranges or tags (for example `@^1.2.7`) so installed package resources still load instead of being treated as mismatched exact pins ([#5695](https://github.com/earendil-works/pi/issues/5695)). diff --git a/packages/coding-agent/docs/extensions.md b/packages/coding-agent/docs/extensions.md index 7038351d..ab3188ce 100644 --- a/packages/coding-agent/docs/extensions.md +++ b/packages/coding-agent/docs/extensions.md @@ -1534,21 +1534,21 @@ const result = await pi.exec("git", ["status"], { signal, timeout: 5000 }); ### pi.getActiveTools() / pi.getAllTools() / pi.setActiveTools(names) -Manage active tools. This works for both built-in tools and dynamically registered tools. +Manage active tools. This works for both built-in tools and dynamically registered tools. `pi.getActiveTools()` returns the active tool names as `string[]`; `pi.getAllTools()` returns metadata for all configured tools. ```typescript -const active = pi.getActiveTools(); +const active = pi.getActiveTools(); // ["read", "bash", ...] const all = pi.getAllTools(); -// [{ +// all = [{ // name: "read", // description: "Read file contents...", // parameters: ..., // promptGuidelines: ["Use read to examine files instead of cat or sed."], // sourceInfo: { path: "", source: "builtin", scope: "temporary", origin: "top-level" } // }, ...] -const names = all.map(t => t.name); const builtinTools = all.filter((t) => t.sourceInfo.source === "builtin"); const extensionTools = all.filter((t) => t.sourceInfo.source !== "builtin" && t.sourceInfo.source !== "sdk"); +pi.setActiveTools([...new Set([...active, "my_custom_tool"])]); // Keep current tools and enable my_custom_tool pi.setActiveTools(["read", "bash"]); // Switch to read-only ```