# pi-disable-tools

> English (current) | [简体中文](README.md)

A pi extension that removes unwanted tools straight from the **system prompt**: once disabled, the model can neither see the tool nor call it.

## Features

- `/disable-tools` — opens the interactive toggle menu
- Select an item to toggle it: `✅ read` (enabled) / `⛔ write` (disabled)
- The title shows the live disabled count: `Tool toggles (disabled 2/23)`
- Covers every tool: built-ins (`read`/`bash`/`edit`/`write`/`grep`/`find`/`ls`), extension-registered tools, and dynamically registered ones such as MCP tools
- Each row shows its origin: `· builtin` / `· extension` / `· sdk`

```
Tool toggles (disabled 1/23)  select to toggle
  ✅ bash  · builtin
  ✅ edit  · builtin
  ✅ read  · builtin
  ⛔ write · builtin
  ✅ web_search  · extension
  ✳️ Enable all
  🔙 Done
```

## How it differs from blocking

Pi offers two ways to control tools; this extension uses the first:

| Approach | Effect |
|---|---|
| **`setActiveTools()` (this extension)** | Removed from the system prompt — **the model doesn't know it exists**, saving tokens and preventing accidental calls |
| `tool_call` blocking | The tool stays visible to the model; only execution is refused |

## Configuration

Persisted to `~/.pi/agent/extensions/pi-disable-tools/config.json`, **global** (applies to every project and workspace):

```json
{
  "disabled": ["write", "edit"]
}
```

## When it applies

| Timing | Effect |
|---|---|
| `session_start` | Applies the persisted config |
| `before_agent_start` | Tightens again before each submission |
| `tool_call` | Fallback block, so a tool re-registered by another extension still cannot execute |

## Interop with other extensions

Routine syncing only **subtracts**:

```
new active = current active − disabled list
```

So it coexists correctly:

- tool-tightening extensions such as plan-mode → tools it removed are not added back by this extension
- tools added by MCP / tool loaders → kept unless explicitly disabled

> Only the menu's "Enable all" performs an explicit union, which can override another extension's tightening;
> that is the expected behavior when the user explicitly asks for everything to be enabled.

## Installation

```bash
pi install npm:pi-disable-tools
```

Or add it to `~/.pi/agent/settings.json`:

```json
{
  "packages": ["pi-disable-tools"]
}
```

## License

ISC
