feat(coding-agent): add exclude tools option closes #5109

This commit is contained in:
Mario Zechner
2026-05-28 23:49:01 +02:00
parent 1ab2899800
commit 9380d5f2e4
12 changed files with 147 additions and 6 deletions

View File

@@ -472,6 +472,7 @@ Specify which built-in tools to enable:
- Default built-ins: `read`, `bash`, `edit`, `write`
- `noTools: "all"` disables all tools
- `noTools: "builtin"` disables default built-ins while keeping extension and custom tools enabled
- `excludeTools` disables specific built-in, extension, or custom tool names after any `tools` allowlist is applied
The `edit` tool returns `details.diff` for Pi's TUI display and `details.patch` as a standard unified patch for SDK consumers.
@@ -487,6 +488,11 @@ const { session } = await createAgentSession({
const { session } = await createAgentSession({
tools: ["read", "bash", "grep"],
});
// Disable one tool while keeping the rest available
const { session } = await createAgentSession({
excludeTools: ["ask_question"],
});
```
#### Tools with Custom cwd

View File

@@ -184,6 +184,7 @@ cat README.md | pi -p "Summarize this text"
| Option | Description |
|--------|-------------|
| `--tools <list>`, `-t <list>` | Allowlist specific built-in, extension, and custom tools |
| `--exclude-tools <list>`, `-xt <list>` | Disable specific built-in, extension, and custom tools |
| `--no-builtin-tools`, `-nbt` | Disable built-in tools but keep extension/custom tools enabled |
| `--no-tools`, `-nt` | Disable all tools |
@@ -255,6 +256,9 @@ pi --models "claude-*,gpt-4o"
# Read-only mode
pi --tools read,grep,find,ls -p "Review the code"
# Disable one extension or built-in tool while keeping the rest available
pi --exclude-tools ask_question
```
### Environment Variables