Expand description
Built-in tool implementations.
Pi provides 7 built-in tools: read, bash, edit, write, grep, find, ls.
Tools are exposed to the model via JSON Schema (see crate::provider::ToolDef) and executed
locally by the agent loop. Each tool returns structured ContentBlock output suitable for
rendering in the TUI and for inclusion in provider messages as tool results.
Structs§
- Bash
RunResult - Bash
Tool - Edit
Tool - Find
Tool - Grep
Tool - LsTool
- Processed
Files - Result of processing
@fileCLI arguments. - Read
Tool - Tool
Output - Tool execution output.
- Tool
Registry - Registry of enabled tools for a Pi run.
- Tool
Update - Incremental update during tool execution.
- Truncation
Result - Result of truncation operation.
- Write
Tool
Enums§
Constants§
- DEFAULT_
BASH_ TIMEOUT_ SECS - Default timeout (in seconds) for bash tool execution.
- DEFAULT_
FIND_ LIMIT - Default find result limit.
- DEFAULT_
GREP_ LIMIT - Default grep result limit.
- DEFAULT_
LS_ LIMIT - Default ls result limit.
- DEFAULT_
MAX_ BYTES - Default maximum bytes for truncation.
- DEFAULT_
MAX_ LINES - Default maximum lines for truncation.
- GREP_
MAX_ LINE_ LENGTH - Maximum line length for grep results.
- IMAGE_
MAX_ BYTES - Maximum size for an image to be sent to the API (4.5MB).
- LS_
SCAN_ HARD_ LIMIT - Hard limit for directory scanning in ls tool to prevent OOM/hangs.
- READ_
TOOL_ MAX_ BYTES - Hard limit for read tool file size (100MB) to prevent OOM.
- WRITE_
TOOL_ MAX_ BYTES - Hard limit for write/edit tool file size (100MB) to prevent OOM.
Traits§
- Tool
- A tool that can be executed by the agent.
Functions§
- cleanup_
temp_ files - Clean up old temporary files created by the bash tool.
- kill_
process_ tree - process_
file_ arguments - Process
@filearguments into a single text prefix and image attachments. - truncate_
head - Truncate from the beginning (keep first N lines).
- truncate_
tail - Truncate from the end (keep last N lines).