Skip to content

Commit b5e13bc

Browse files
committed
docs(coding-agent): clarify active tools docs
closes earendil-works#5729
1 parent 93b3b7c commit b5e13bc

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

packages/coding-agent/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
### Fixed
1010

11+
- 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)).
1112
- 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)).
1213
- 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)).
1314
- 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)).

packages/coding-agent/docs/extensions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,21 +1534,21 @@ const result = await pi.exec("git", ["status"], { signal, timeout: 5000 });
15341534

15351535
### pi.getActiveTools() / pi.getAllTools() / pi.setActiveTools(names)
15361536

1537-
Manage active tools. This works for both built-in tools and dynamically registered tools.
1537+
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.
15381538

15391539
```typescript
1540-
const active = pi.getActiveTools();
1540+
const active = pi.getActiveTools(); // ["read", "bash", ...]
15411541
const all = pi.getAllTools();
1542-
// [{
1542+
// all = [{
15431543
// name: "read",
15441544
// description: "Read file contents...",
15451545
// parameters: ...,
15461546
// promptGuidelines: ["Use read to examine files instead of cat or sed."],
15471547
// sourceInfo: { path: "<builtin:read>", source: "builtin", scope: "temporary", origin: "top-level" }
15481548
// }, ...]
1549-
const names = all.map(t => t.name);
15501549
const builtinTools = all.filter((t) => t.sourceInfo.source === "builtin");
15511550
const extensionTools = all.filter((t) => t.sourceInfo.source !== "builtin" && t.sourceInfo.source !== "sdk");
1551+
pi.setActiveTools([...new Set([...active, "my_custom_tool"])]); // Keep current tools and enable my_custom_tool
15521552
pi.setActiveTools(["read", "bash"]); // Switch to read-only
15531553
```
15541554

0 commit comments

Comments
 (0)