readFile
Reads a file from a CodeSandbox sandbox filesystem per call using sandbox and session IDs, returning UTF-8 or Base64 content.
Instructions
Read a file from the sandbox filesystem. Stateless: connects per call using sandboxId+sessionId.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"sandboxId": "<sandboxId>",
"sessionId": "<sessionId>",
"path": "<path>"
},
"name": "readFile"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| env | No | Optional environment variables if the session is created. | |
| path | Yes | Absolute path inside the sandbox filesystem. | |
| encoding | No | How to encode the returned content. Defaults to 'utf8'. | |
| sandboxId | Yes | Target sandbox ID to operate on. | |
| sessionId | Yes | Session identifier to connect with. If missing in the sandbox, it will be created. | |
| permission | No | Optional permission if session needs to be created. Defaults to 'read' when server is read-only. |