typst_read_file
Read Typst project text files in bounded line/byte pages or images as native image blocks, returning source content, continuation offsets, and content hashes for safe edits.
Instructions
Read project text in bounded pages (default 200 lines/16 KiB) or images as native image blocks. content contains source only; use nextOffset for continuation. contentHash covers the entire raw text file: pass it as expectedHash to typst_edit_file. Compact file metadata by default; output='full' adds metadata, not extra source lines. Use grep to locate relevant lines before reading large files.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum complete lines to read (default: 200). Use nextOffset to continue. | |
| offset | No | Line number to start reading from (1-indexed) | |
| output | No | compact (default): minimal file metadata; full: all file metadata. Both use offset/limit/maxBytes pagination. | |
| filePath | Yes | File path/name (e.g. 'main.typ') or file ID | |
| maxBytes | No | Maximum returned source bytes, including line number prefixes (default: 16384, maximum: 1 MiB). Increase for unusually long lines. | |
| projectId | Yes | The Typst project ID | |
| lineNumbers | No | Whether to prefix each line with its 1-indexed line number (e.g. '1 | ') |