Skip to main content
Glama

Read file

read_file
Read-only

Read one file from the sandbox: text is returned as text (very long text is shortened in the middle), binary files as base64 (up to 5 MB). Use it to inspect a file or hand its content to the user. For large logs read just the part you need with a shell command (tail, head, grep); result files of background jobs are read from the job, not from a sandbox.

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

Input Schema

NameRequiredDescriptionDefault
pathYesAbsolute path to the file
sandbox_idNoSandbox ID (sb_…). If omitted, the current sandbox of this session is used. A sandbox_id you pass becomes the current sandbox for later calls without sandbox_id.

Output Schema

NameRequiredDescriptionDefault
pathYesPath of the file.
sizeYesFile size in bytes.
contentYesFile content (long text is shortened in the middle).
encodingYestext = content as is; base64 = binary file encoded in base64.
shortenedYesText content was shortened in the middle.
sandbox_idYesSandbox ID.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / sandbox_id / description
      Previous value: -"Sandbox ID (sb_…). If omitted, the current sandbox of this session is used."New value: +"Sandbox ID (sb_…). If omitted, the current sandbox of this session is used. A sandbox_id you pass becomes the current sandbox for later calls without sandbox_id."
  2. First observed

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, so safety is covered, but the description adds genuinely new behavior: long text is truncated in the middle, binaries are base64 with a 5 MB ceiling. It does not cover failure behavior (missing path, permission or sandbox-scope errors), which keeps it from the top score.

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

Conciseness5/5

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

Three compact clauses ordered by importance: what is returned and its limits, the intended use, then the alternative paths. No filler or restatement of the tool name, and the size/truncation caveat is front-loaded where an agent will see it.

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

Completeness5/5

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

With an output schema present, the description need not explain return values, and annotations cover the safety profile. For a two-parameter read tool, the format, size cap, truncation behavior, and fallback routing together make it complete enough to invoke correctly on the first try.

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 description coverage is 100% and both parameters are documented in-schema, including the sandbox_id stickiness rule and the absolute-path requirement, so the baseline is 3. The description adds no parameter-level meaning beyond the schema.

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

Purpose5/5

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

States a specific verb and resource with scope ("Read one file from the sandbox") and immediately distinguishes by output handling: text as text with mid-string shortening, binary as base64 capped at 5 MB. An agent can tell this apart from list_files, write_file, or get_job_logs from the description alone.

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

Usage Guidelines5/5

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

Gives an explicit positive case ("inspect a file or hand its content to the user") and two negative routings with alternatives: use shell commands like tail/head/grep for large logs, and read background-job result files from the job rather than the sandbox. That is when-to-use plus when-not-to-use with named alternatives.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources