Skip to main content
Glama

fs_read

Read-onlyIdempotent

Get file, download file, fetch file contents, view file, cat, ls — read a file or list a directory from the project filesystem. If the path ends with / or matches a directory, returns a directory listing; otherwise returns the file content.

There are two file surfaces: deployed source is read with project_files_list / project_file_read; fs_read, fs_write, and fs_upload use runtime storage via sw.fs. Project source such as src/App.tsx or api/foo.ts is read with project_file_read, not fs_read.

Optional lines returns only a line range from a text file as JSON with { content, lines: [start, end], total_lines } — useful for peeking into large files without downloading them whole.

For a directory listing, recursive: true returns every descendant in one call, with an optional depth cap.

Example:

// Read a whole file:
{ "project_id": "my-saas", "path": "/uploads/users/alice/avatar.png" }

// Read lines 50–75 of a stored text file:
{ "project_id": "my-saas", "path": "/logs/import-run.txt", "lines": "50-75" }

// List a directory (immediate children):
{ "project_id": "my-saas", "path": "/uploads/users/" }

// List a directory tree, two levels deep:
{ "project_id": "my-saas", "path": "/uploads/", "recursive": true, "depth": 2 }

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

Input Schema

NameRequiredDescriptionDefault
pathYesFull path with leading slash. A trailing slash (or a directory path) returns a listing.
depthNoOptional. When recursive, cap how many levels below the directory to include.
linesNoOptional line range as "START-END" (1-indexed, inclusive). Text files only.
recursiveNoOptional. For a directory listing, include every descendant (not just immediate children).
project_idYesProject ID (UUID), subdomain, or slug — resolved server-side, no UUID lookup needed. 'default' also works when the account has exactly one project; multi-project accounts must name one (the error lists them).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior3/5

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

The annotations already declare readOnlyHint and idempotentHint, so the safety profile is covered. The description adds real behavioral detail, namely the conditional return type (listing vs content) and the JSON response shape for line ranges, but says nothing about binary handling (the example reads a `.png`), size limits, or error behavior.

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?

It is front-loaded with the core verb and resource, then narrows to surface routing, then optional features, then four compact examples. The keyword aliases in the first line are slightly redundant but help with search-style matching, and the examples replace paragraphs of prose.

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 5-parameter read tool with no output schema, the description covers path semantics, line ranges, recursion, and the return-type branch well. The remaining gap is binary/large-file behavior, which matters for a tool whose own example targets a `.png`.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, yet the description earns more by showing the `"50-75"` line-range syntax in context, tying `depth` to `recursive`, and explaining that a trailing slash triggers a listing. It also documents the response envelope for line reads, which the schema cannot express.

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?

The description opens with concrete aliases (get/download/fetch/view/cat/ls) and then states precisely what the tool returns: a directory listing if the path is a directory, otherwise file contents. It also distinguishes this tool from the sibling `project_file_read` by explaining the two file surfaces (deployed source vs runtime storage via `sw.fs`).

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?

It gives an explicit routing rule: `src/App.tsx` or `api/foo.ts` must be read with `project_file_read`, not `fs_read`. It also states when to use `lines` (peeking into large files instead of downloading whole) and when to use `recursive`/`depth` (whole-tree listings).

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