Skip to main content
Polpo gives agents built-in system tools to interact with the workspace, plus extended tool categories (browser, email, vault, image, audio, and search).
For a higher-level overview of all tools and filesystem sandboxing, see Tools.

read — Read File

Read the contents of a file with line numbers.

Parameters

ParameterTypeRequiredDescription
pathstringyesAbsolute or relative path to the file
offsetnumbernoLine number to start from (1-indexed)
limitnumbernoMax number of lines to read (default: 500)

Returns

Line-numbered text with format: <line_number>\t<content>

Example

{
  path: "src/index.ts",
  offset: 10,
  limit: 50
}

Notes

  • Maximum 500 lines per read by default
  • Use offset and limit for large files
  • Returns truncation notice if file has more lines

write — Write File

Create or overwrite a file with the given content.

Parameters

ParameterTypeRequiredDescription
pathstringyesAbsolute or relative path to write to
contentstringyesFile content to write

Returns

Confirmation message with file path and byte count.

Example

{
  path: "src/utils/helper.ts",
  content: "export function add(a: number, b: number) { return a + b; }"
}

Notes

  • Parent directories are created automatically
  • Overwrites existing files without confirmation
  • Use for creating new files or full rewrites

edit — Edit File

Replace a unique string in a file.

Parameters

ParameterTypeRequiredDescription
pathstringyesAbsolute or relative path to the file
old_textstringyesExact text to find and replace (must be unique)
new_textstringyesReplacement text

Returns

Confirmation message with character counts.

Errors

  • not_found: old_text not found in file
  • not_unique: old_text appears multiple times (ambiguous)

Example

{
  path: "src/config.ts",
  old_text: "port: 3000",
  new_text: "port: 8080"
}

Notes

  • old_text must appear exactly once in the file
  • Use read first to verify exact text to replace
  • For multiple replacements, call edit multiple times

bash — Execute Shell

Execute a shell command and return its output.

Parameters

ParameterTypeRequiredDescription
commandstringyesShell command to execute
timeoutnumbernoTimeout in milliseconds (default: 120000)

Returns

Combined stdout/stderr output, exit code, and timing information.

Example

{
  command: "npm test",
  timeout: 300000  // 5 minutes
}

Notes

  • Default timeout: 2 minutes
  • Runs in the working directory (cwd)
  • Use for: tests, git operations, package installs, builds
  • Output limited to 30KB (truncated if larger)
  • Command killed with SIGTERM on timeout, then SIGKILL after 3s

glob — Find Files

Find files matching a glob pattern.

Parameters

ParameterTypeRequiredDescription
patternstringyesGlob pattern (e.g., **/*.ts, src/**/*.js)
pathstringnoDirectory to search in (default: cwd)

Returns

List of matching file paths (relative to cwd), newline-separated.

Example

{
  pattern: "**/*.test.ts",
  path: "src"
}

Notes

  • Maximum 200 results
  • Uses find command under the hood
  • Paths returned relative to working directory

grep — Search Code

Search for a regex pattern in files.

Parameters

ParameterTypeRequiredDescription
patternstringyesRegex pattern to search for
pathstringnoFile or directory to search in (default: cwd)
includestringnoFile glob filter (e.g., *.ts)

Returns

Matching lines with format: <file>:<line_number>:<content>

Example

{
  pattern: "function.*async",
  include: "*.ts",
  path: "src"
}

Notes

  • Maximum 100 results
  • Uses grep -rn -E under the hood
  • Regex is extended regex (ERE) format
  • Returns “No matches found” if pattern not found

ls — List Directory

List files and directories in a given path.

Parameters

ParameterTypeRequiredDescription
pathstringnoDirectory to list (default: cwd)

Returns

List of files and directories (newline-separated). Directories end with /.

Example

{
  path: "src/components"
}

Notes

  • Directories marked with trailing /
  • Returns all entries (no filtering or pagination)
  • Use glob for pattern-based file finding

Tool Filtering

Restrict tools per-agent using allowedTools configuration:
{
  "agents": [
    {
      "name": "readonly-agent",
      "allowedTools": ["read", "glob", "grep", "ls"]
    }
  ]
}
If allowedTools is not specified, all 9 core tools are available.

Security Considerations

bash Tool

  • Runs commands with full shell access
  • No sandboxing or command filtering
  • Use with trusted agents only
  • Consider restricting via allowedTools for untrusted workloads

File Operations

  • write and edit can modify any file in the working directory
  • No write protection or backup
  • Agents can delete files via bash tool
  • Consider version control (git) for protection

Best Practices

Reading Large Files

// Bad: Read entire 10k line file
{ path: "large.txt" }

// Good: Read in chunks
{ path: "large.txt", offset: 1, limit: 500 }
{ path: "large.txt", offset: 501, limit: 500 }

Editing Files

// Step 1: Read to find exact text
{ path: "config.ts", offset: 1, limit: 50 }

// Step 2: Edit with exact match
{
  path: "config.ts",
  old_text: "const PORT = 3000;",
  new_text: "const PORT = 8080;"
}

Searching Code

// Bad: Broad search
{ pattern: "function" }  // 1000s of results

// Good: Specific search
{ pattern: "async function handle.*Request", include: "*.ts" }

Extended Tool Categories

Beyond the 9 core tools, Polpo offers 7 optional tool categories that can be enabled per-agent via the allowedTools array.
{
  "name": "outreach-agent",
  "allowedTools": ["read", "write", "edit", "bash", "glob", "grep", "ls", "browser_*", "email_*", "vault_*", "image_*", "video_*", "audio_*", "search_*"]
}
CategoryToolsEnable via allowedToolsDescription
Browser18"browser_*"Browser automation via agent-browser CLI
Email5"email_*"Send emails via SMTP, read via IMAP
Vault2"vault_*"Read-only access to agent’s own vault credentials
Image3"image_*"Image generation (fal.ai FLUX) and vision analysis (OpenAI/Anthropic)
Video1"video_*"Text-to-video generation via fal.ai Wan 2.2
Audio2"audio_*"Speech-to-text (STT) and text-to-speech (TTS)
Search2"search_*"Semantic web search and similar-page discovery via Exa AI
Git, multi-file, dependency management, Excel/CSV, PDF, and Word/DOCX tools have been removed as built-in tool categories. Use the bash tool with appropriate CLI commands or install skills for these operations instead. HTTP tools (http_fetch, http_download) are now always-on core tools — no flag needed.
Click any category above for full parameter documentation, return types, and usage notes.

Implementation

Tools are defined in src/tools/coding-tools.ts using TypeBox schemas for parameter validation. Each tool implements the AgentTool interface from @mariozechner/pi-agent-core:
interface AgentTool<TSchema> {
  name: string;
  label: string;
  description: string;
  parameters: TSchema;
  execute(toolCallId: string, params: ParamsType, signal?: AbortSignal): Promise<AgentToolResult>;
}