Skip to main content
Glama
CodeSandbox MCP Server

CodeSandbox MCP Server

by techlibs

readFile

Read-only

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

NameRequiredDescriptionDefault
envNoOptional environment variables if the session is created.
pathYesAbsolute path inside the sandbox filesystem.
encodingNoHow to encode the returned content. Defaults to 'utf8'.
sandboxIdYesTarget sandbox ID to operate on.
sessionIdYesSession identifier to connect with. If missing in the sandbox, it will be created.
permissionNoOptional permission if session needs to be created. Defaults to 'read' when server is read-only.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.1

TDQS

B3.3/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, so the safety profile is covered. The description adds genuinely new context — that each call is stateless and reconnects using sandboxId+sessionId, and implies session creation if absent. It does not address return behavior for large or binary files, or failure modes.

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, zero filler, with the core purpose front-loaded and the operational caveat second. Every clause carries information.

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?

With six parameters (nested env object, two enums) and no output schema, the description is adequate but thin: it never states that file contents are returned (and encoded per the encoding param), nor how non-text content or errors are surfaced. The schema covers parameter meaning, so the gap is behavioral rather than structural.

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%, so all six parameters are already documented, including encoding, permission, and env semantics. The description only clarifies that sandboxId and sessionId are consumed together per call, which is a minor addition beyond 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 gives a specific verb and resource ('Read a file from the sandbox filesystem'), which is clearly distinguishable from the sibling 'writeFile'. It stops short of naming siblings explicitly, but the read semantics are unambiguous.

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

Usage Guidelines2/5

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

There is no explicit when-to-use guidance, no conditions for choosing this over readdir or writeFile, and no exclusions. The second sentence describes mechanics (stateless connection), not selection criteria.

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