Example

See which tools Pi declares to the model

Trace how defaultTools and the one-shot --tools override decide the active set, and where the 1.0.4 MCP exception lives.

Pi declares an active tool set to the model; that set is what the model may ask for. Three inputs compose it: built-in tools, tools registered by extensions, and MCP tools. defaultTools edits the user’s selection, --tools replaces it for one invocation, and the same syntax means different things in the two places.

The default selection and its two edits

settings.md defaults defaultTools to read, bash, edit, and write. Within a settings list a plain name replaces the selection, +name adds, and -name removes, in order:

defaultTools list Meaning
["read","bash","edit","write"] The defaults, unchanged
["+grep","+find","+ls"] Adds three search tools on top of the defaults
["read","powershell"] A two-tool agent: the plain list replaces
["-bash"] The defaults minus Bash
["+codemode"] Adds the off-by-default codemode built-in extension tool

codemode and tool_search come from built-in extensions and are off by default; they switch on when an MCP server with that exposure needs them. A project settings file applies on top of the user file (Chapter 7 owns that merge in detail).

The one-shot override is a different syntax

On the command line, --tools replaces the whole selection, and +name / -name are rejected there:

pi --tools read,grep,find,ls --no-mcp --print "Review this project"
pi --tools read,bash,edit,write,codemode

The override lasts for that invocation (including across /reload).

The 1.0.4 exception

--tools narrows built-in, extension, and custom tools — but not MCP tools. On 1.0.4, if a server is configured, the MCP tools stay even when --tools does not name them, so --no-mcp is needed to remove them. There is no way to say “all tools except these” on the command line.

Mechanism and limitations

Documented: settings.md describes the defaults and the plain/+/− rules; the off-by-default built-in extensions are documented in extensions.md. Observed: the Chapter 7 tests assert defaultTools edit-versus-replace semantics through the real SettingsManager; headless.test.ts shows --tools narrowing an agent — a model that asks for Bash gets a failed result and nothing runs; tool-allowlist.test.ts exercises disabledBuiltinExtensions and the mcp__ naming. The MCP exception is recorded in the chapter as a 1.0.4 behaviour, so it is version-sensitive.

Declaring a tool makes it available; it does not make the model use it, and it does not make a use authorised — tools run with the operating-system permissions of the Pi process. This example shows how the declared set is composed, not what a real model does with it.

Read the chapter and the examples directory .

Understand this example

Copy this prompt into your AI tool. No code runs here.

Apply this example

Copy this prompt into your AI tool. No code runs here.