Skip to main content
Glama

read_file

Safely read file contents within a sandbox's /workspace directory while enforcing path traversal checks.

Instructions

Safely reads the contents of a file inside the sandbox /workspace directory. Enforces path traversal security checks.

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
pathYesRelative path inside /workspace to read
sandboxIdYesSandbox ID

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.6/5.0
Behavior3/5

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

With no annotations, the description carries the full burden, and it does disclose the sandbox confinement and path-traversal enforcement, which are meaningful safety traits. However, it omits error behavior for missing/outside paths, file size or encoding limits, and whether binary content is supported.

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?

Two short sentences, front-loaded with the primary action and followed by the key security constraint; nothing is redundant or padded.

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

Completeness4/5

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

For a simple two-parameter read tool with a fully described schema and no output schema, the definition covers scope and safety adequately. It could be stronger by noting that the return value is the file's text content and what happens on failure.

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 100%, so both parameters are already documented. The description adds only the constraint that paths resolve inside /workspace, which corroborates rather than extends the schema's 'Relative path inside /workspace' wording.

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?

States a specific verb and resource ('reads the contents of a file') and scopes it precisely to '/workspace' inside a sandbox. It implicitly contrasts with write_file via the verb, but never names siblings or explicitly demarcates read vs. write operations.

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?

Usage is only implied: read files in the sandbox workspace. There is no explicit when-to-use vs. alternatives such as execute_command (cat) or git_diff, and no stated preconditions like the sandbox needing to exist first.

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