Tools · Files and code

read_file

Read-only

Read a file from the local project. Text files return line-numbered content; Word/Excel/PowerPoint/HTML/CSV documents are extracted to clean Markdown; images and PDFs return as viewable media.

When to use: Use this to inspect source files, config files, logs, and artifacts in the local project.

Example

Run for real by scripts/tool-examples.py in a small demo project, with Haiku 5.5 where the tool calls a model. The output is exactly what the tool returned.

The call

tool call
{
  "tool": "read_file",
  "arguments": {
    "path": "src/pricing.py"
  }
}

Real output

1: """Seat pricing for the demo app."""
    2: 
    3: PLANS = {"starter": 12.0, "team": 29.0}
    4: 
    5: 
    6: def price(plan: str, seats: int) -> float:
    7:     return PLANS[plan] * seats

Parameters

NameTypeDescription
path*stringRelative file path
start_linenumber1-based starting line number
max_linesnumberMaximum number of lines to return

* required

Read, search and edit the project; run commands, code and git.