Skip to main content

Module tools

Module tools 

Source
Expand description

Built-in tools: read, bash, edit, write, and the optional grep, find and ls.

Ports of packages/coding-agent/src/core/tools in pi v1.0.0. Declarations (names, descriptions, schemas) match pi byte for byte, because they are part of every request.

Re-exports§

pub use bash::Bash;

Modules§

bash
bash: run a command, stream its combined output, keep the tail.
external
rg and fd for the grep and find tools: the agent’s copy, else the system’s, else a download of the latest release.
mutation
Serializes writes to the same file across concurrently running tool calls.
path
Resolving paths the model writes: @ prefixes, ~, file://, odd spaces, and the macOS screenshot and quote variants of existing files.
registry
The session’s tools and which of them are active, as pi’s AgentSession keeps them (_refreshToolRegistry, _applyToolLoadout in pi v1.0.0).
truncate
Output truncation shared by the tools: by lines and by bytes, from the head or the tail.

Structs§

Described
A tool declared with another description. Everything else is the tool’s.
Edit
The edit tool.
Find
The find tool.
Grep
The grep tool.
Ls
The ls tool.
Namespace
A group of tools, such as one MCP server’s.
Read
The read tool.
RegisteredTool
A tool as registered with a session: the tool, the text it adds to the system prompt, and how it reaches the model.
Replacement
One requested replacement.
Runtime
Session state tools read while running.
ToolEnv
What built-in tools share: the working directory, the session state and where helper binaries live.
Write
The write tool.

Enums§

Exposure
pi’s ToolExposure: how a tool reaches the model.

Constants§

BUILTIN_TOOLS
Every built-in tool, in pi’s registration order.
DEFAULT_TOOLS
Names of the tools active by default.

Functions§

builtin
Creates the named built-in tool.
image_mime_type
The MIME type of a supported image, from its first 4100 bytes as pi sniffs them.
js_number
A number as JavaScript prints it.
node_error
The message Node gives a failed file system call, such as ENOENT: no such file or directory, access '/a/b'.
preview_edits
pi’s computeEditsDiff: the diff edits would make to the file at path (resolved against cwd), or why they cannot apply. Nothing is written.