-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Summary
Make Read deterministic and robust for long files and PDFs.
Scope
- Enforce absolute
file_path. Reject relative paths. - Defaults: read from line 1, up to 2000 lines.
- Truncate any line > 2000 characters.
- Output format:
cat -nstyle (6-wide right-justified number + tab), numbering starts at 1. - Support
offsetandlimitfor paging. - PDFs: extract text page by page. Insert page headers. Basic image handling optional.
- If file exists but is empty, return a clear reminder line instead of empty output.
- Return consistent errors.
Input schema
{
"type": "object",
"additionalProperties": false,
"properties": {
"file_path": { "type": "string", "description": "Absolute path" },
"limit": { "type": "integer", "minimum": 1 },
"offset": { "type": "integer", "minimum": 1 }
},
"required": ["file_path"]
}Acceptance criteria
- Relative paths return
NOT_ABSOLUTE_PATH. - Nonexistent files return
NOT_FOUND. - Exact
cat -nprefix:"%6d\t%s". - Defaults applied:
offset=1,limit=2000, per-line cap 2000 chars. - Empty file returns a single reminder line and a
FILE_EMPTYwarning. - PDFs render text per page with page headers; parse failures return
PDF_PARSE_ERROR. - Binary or undecodable text returns
UNREADABLE_BINARY. - Unit tests cover large files, long lines, paging edges, PDFs, and golden tests for numbering at 1, 9, 10, 99, 100, 1000.
- Other read Bash tool whitelisted commands are removed and Read will be used instead
Reactions are currently unavailable