Skip to main content
Glama

Read Workspace file

read_workspace_file
Read-only

Read UTF-8 files or list directory entries from any saved Workspace revision without starting a run or modifying files.

Instructions

Read a file or list a directory in a saved revision of a Workspace: the Workspace's current_revision, a worker's saved_revision_id, or a changeset's base_revision, incoming_revision or result_revision. A file returns its UTF-8 text, up to 262144 bytes; a larger file is refused, and a binary file is refused with 415. A directory returns its entries one page at a time. No run starts and nothing changes.

Input Schema

NameRequiredDescriptionDefault
pathYesThe file or directory path, relative to the Workspace root, for example src/main.go or / for the root.
cursorNoFor a directory: next_cursor from the previous page.
revision_idNoThe saved revision to read. Omitted, the Workspace's current revision.
workspace_idYesThe Workspace UUID.

Output Schema

NameRequiredDescriptionDefault
kindYesfile or dir.
pathYesThe path that was read.
sizeNoThe file's size in bytes.
textNoThe file's UTF-8 text, for a file.
entriesNoThe directory's entries, for a directory.
next_cursorNoFor a directory with more entries: pass it back as cursor to read the next page.
revision_idYesThe saved revision that was read.
workspace_idYesThe Workspace UUID.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.17.1

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already declare readOnlyHint=true, but the description adds substantive detail beyond them: the 262144-byte cap and refusal behaviour, HTTP 415 for binary files, paginated directory entries, and the explicit 'No run starts and nothing changes' assurance.

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 tightly-packed sentences, front-loaded with the verb and resource, then limits, then the non-mutating guarantee. Nothing is redundant and every sentence carries operational information.

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?

An output schema exists, so return structure need not be restated; the description covers what an agent still needs — size limits, binary rejection, pagination via cursor, and side-effect freedom — for a read tool with a rich but simple schema.

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, but the description adds real meaning to revision_id by enumerating the accepted revision sources (current_revision, saved_revision_id, base/incoming/result_revision) that the schema's one-line field description does not.

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 ('Read a file or list a directory') and enumerates exactly which revisions can be targeted, so the agent can distinguish it from sibling mutation tools like upload_workspace_file or get_workspace_changeset without opening a schema.

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

Usage Guidelines4/5

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

Gives a clear context for use — reading from current_revision, a worker's saved_revision_id, or a changeset's base/incoming/result revision — but never explicitly routes the agent away from alternatives or states preconditions (e.g., when to prefer a changeset tool over reading a revision).

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