Skip to main content
Glama

Read a file from a sandbox

read_file
Read-onlyIdempotent

Retrieve a sandbox file's contents (up to 5 MiB) as UTF-8 or Base64 for inspection or processing. Paths must resolve under /home/user or /tmp.

Instructions

Read a file from a sandbox. Files up to 5 MiB. For a larger file, use POST /sandboxes/{sandboxId}/files/download-url. On a sandbox that is still starting, the call waits until it is ready (up to 60 s, like a command), so it reads the sandbox's own disk and never the machine's stock one.

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>",
      "path": "<path>"
    },
    "name": "read_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesAbsolute path, or path relative to the sandbox work directory (/home/user). The canonicalized path must resolve under /home/user or /tmp; anything else is rejected with a 400 invalid_path error.
encodingNoutf8
sandboxIdYesPublic Sandbox id returned by create/list/get sandbox calls.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.0.0

TDQS

A3.6/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnly, idempotent, and non-destructive, so the safety profile is covered. The description adds real behavioral context beyond that: a 5 MiB size ceiling, a blocking wait of up to 60 s on a starting sandbox, and the guarantee that it reads the sandbox's own disk rather than the host's. It does not describe the shape of the returned content.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three short sentences, front-loaded with the operation and then the limits, with no filler. The closing clause about the 'machine's stock one' is slightly awkward but conveys a real constraint.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

There is no output schema, so the description carries the burden of explaining what comes back — and it never says whether content is returned as text or base64, or how encoding maps to the response. Operational constraints (size, wait, path sandboxing) are well covered, making the return-value gap the main omission.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is a middling 67% — path and sandboxId are well documented in the schema, while encoding has only an enum and no prose. The description adds nothing about parameter meaning (e.g., how encoding affects the returned payload), so it neither compensates for nor improves on the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb+resource ('Read a file from a sandbox'), which is unambiguous about the operation. It does not explicitly contrast with the close sibling read_snapshot_file, so an agent must infer the sandbox-vs-snapshot distinction from the resource name alone.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives one clear exclusion — files over 5 MiB should go through the download-url endpoint — which is genuinely useful routing. However, it offers no guidance on when to prefer this over sibling tools like read_snapshot_file or find_in_files, leaving the main selection decision to the agent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.