read_file
Read text and document files (PDF, DOCX, PPTX, XLSX, ODT, ODP, ODS) with flexible modes: full file, first N lines, last N lines, or a specific line range. Extracts PDF content with format metadata.
Instructions
Read files with flexible modes. Supports text and documents (PDF, DOCX, PPTX, XLSX, ODT, ODP, ODS). PDF: Extracts with format metadata (fonts, colors, layout). Modes: full (entire file), head (first N lines), tail (last N lines), range (lines from startLine to endLine, inclusive, 1-indexed). Document files ignore mode parameters and always return full content. Only works within allowed directories.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path to the file to read | |
| mode | No | Read mode: 'full' reads entire file, 'head' reads first N lines, 'tail' reads last N lines, 'range' reads lines from startLine to endLine (inclusive, 1-indexed). Document files (PDF, DOCX, etc.) ignore mode and always return full content. | full |
| lines | No | Number of lines to read (required when mode is 'head' or 'tail', must be positive integer) | |
| startLine | No | Starting line number (1-indexed, required when mode is 'range') | |
| endLine | No | Ending line number (1-indexed, inclusive, required when mode is 'range') |