Read a file from the server
ptero_read_fileRead text files from a Pterodactyl game server to inspect logs, configs, and crash reports, returning content and file size while refusing oversized files.
Instructions
Read a text file from the game server, relative to the server root. Returns the contents plus the file size.
THIS IS THE WAY TO GET FULL BOOT-TIME OUTPUT. Read logs/latest.log. The live console (ptero_get_console_log) only keeps roughly the last 150 lines, so within an hour of boot the plugin startup lines — which port Geyser bound to, which plugin failed to load, why the world took so long — have already rolled out of it. logs/latest.log has the whole history of the current boot; older boots are gzipped in logs/ as <date>-<n>.log.gz (this tool cannot decompress those). If a question is about what happened at startup, read the log file — do not answer from the console buffer and do not assume the buffer is complete.
Other good uses: plugin configuration (plugins/Geyser-Spigot/config.yml), server.properties, eula.txt, crash reports in crash-reports/.
Size guard: the tool first checks the size in the directory listing and REFUSES to fetch anything larger than max_bytes (default from PTERODACTYL_MAX_READ_BYTES, hard cap 4 MiB, which is the panel's own limit). It never partially downloads a huge file. head_lines / tail_lines trim AFTER the download, so they do not help you get past the size guard — the panel has no range-read endpoint.
Binary files (jars, region files, images) are not readable this way; use ptero_list_files to inspect them by size and date instead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | File path relative to the server root, e.g. `logs/latest.log` or `plugins/Geyser-Spigot/config.yml`. Leading slashes are optional. Use ptero_list_files if you are unsure of the exact path. | |
| server | No | Server short identifier (e.g. 1a2b3c4d). Omit to use PTERODACTYL_DEFAULT_SERVER. Call ptero_list_servers to discover valid identifiers. | |
| max_bytes | No | Refuse to read a file larger than this many bytes. Defaults to PTERODACTYL_MAX_READ_BYTES. Hard-capped at 4194304 (4 MiB), the panel's own edit-size limit. Raise it deliberately when a refusal tells you the file is bigger than the default but still within the cap. | |
| head_lines | No | Return only the first N lines. Applied after the full file is fetched. Mutually exclusive with tail_lines. | |
| tail_lines | No | Return only the last N lines. Applied after the full file is fetched, so it reduces context, not download size. Mutually exclusive with head_lines. This is usually what you want for `logs/latest.log`. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Server-relative path that was read. | |
| server | Yes | ||
| content | Yes | File contents, after any head_lines/tail_lines trimming. Verbatim otherwise. | |
| size_bytes | Yes | Full size of the file on disk, per the directory listing. | |
| truncated_to | Yes | null when the whole file is returned. Otherwise describes the trim that was applied, e.g. "last 200 of 5310 lines". | |
| lines_returned | Yes | Number of lines in `content`. |