Overview
read_file provides instant file content access without the overhead of starting a container. Use it to inspect configuration files, review scripts, or check expected content before running commands.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
image | string | Yes | - | Image UUID or tag:name |
path | string | Yes | - | File path to read |
Returns
| Field | Type | Description |
|---|---|---|
path | string | Normalized path that was read |
content | string | File contents (decoded or base64 encoded) |
bytes_size | integer | Size in bytes |
encoding | string | "utf-8" for text files, "base64" for binary |
Cost
Free - No VM spawned. Reads directly from image filesystem.Text Detection
Files are automatically detected as text based on extension. Common text extensions include:- Source code:
.py,.js,.ts,.go,.rs,.java,.c,.h,.cpp - Config:
.json,.yaml,.yml,.toml,.ini,.cfg,.conf - Scripts:
.sh,.bash,.zsh - Documentation:
.md,.rst,.txt - Web:
.html,.css,.xml
Examples
Read Configuration File
Check Python Package Version
Review Script Before Execution
Best Practices
- Prefer over
run("cat")-read_fileis instant and free - Review before executing - Check scripts for safety before running
- Inspect configurations - Understand image setup without running commands
- Verify expected content - Check files contain what you expect
See Also
- list_files - List directory contents without VM
- download - Download file to local filesystem
- Resources -
contree://image/{image}/read/{path}resource alternative