Skip to main content
Glama

github_mcp.read_file

Read-only

Read a repository file from the default branch or an existing job workspace, returning its content, encoding, byte count, checksum and snapshot SHA for safe edits.

Instructions

Read a safe file from the default-branch snapshot or an existing job workspace. Returns content, encoding, byte count and SHA-256 checksum for subsequent edits; text reads also return snapshot SHA. Secret scanning and file-size limits apply.

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

Input Schema

NameRequiredDescriptionDefault
pathYesRepository-relative file path, not an absolute path.
binaryNoAllow base64 output for non-UTF-8 content; default false.
job_idNoOptional existing job ID to read its workspace instead of the default branch.
repositoryYesAllowlisted owner/repo identifier; must match the job if supplied.

Output Schema

NameRequiredDescriptionDefault
okYes
dataNo
messageNo
error_codeNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv1.0.2
    • addedInput schema / properties / binary / description
      Added value: +"Allow base64 output for non-UTF-8 content; default false."
    • addedInput schema / properties / job_id / description
      Added value: +"Optional existing job ID to read its workspace instead of the default branch."
    • addedInput schema / properties / path / description
      Added value: +"Repository-relative file path, not an absolute path."
    • addedInput schema / properties / repository / description
      Added value: +"Allowlisted owner/repo identifier; must match the job if supplied."
  2. First observedv1.0.1

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already declare the read-only, non-destructive, open-world profile, so the bar is lower, and the description still adds real behavior: secret scanning and file-size limits apply, and text reads return a snapshot SHA. That tells the agent about failure modes and staleness tracking that annotations cannot convey. What it does not say is what happens when scanning or size limits reject a read, or whether the snapshot is guaranteed current.

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 sentences, front-loaded with the action and source scopes, followed by returns and constraints. Every clause carries distinct information and nothing is repeated from the schema or annotations.

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?

With a full output schema, complete parameter descriptions and annotations present, the description only needs to cover sources, constraints and read semantics, and it does. The remaining gap is the meaning of 'safe file' and what occurs on a scanning rejection, which an agent would want when planning a read-then-edit workflow.

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 the schema already explains path, binary, job_id and repository in detail. The description adds only marginal meaning, chiefly that the default-branch versus job-workspace choice corresponds to supplying job_id, which is already stated in that parameter's own description. Baseline 3 is appropriate.

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 safe file') plus the two source scopes ('default-branch snapshot' or 'existing job workspace'), which lets an agent distinguish this from mutation siblings like write_file or apply_patch. It stops short of naming the closest read alternatives such as read_files_batch or list_tree, so the boundary is only partially drawn.

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?

The two source modes imply the usage context (routine default-branch reads vs reading a job workspace via job_id), but there is no explicit 'use this instead of X when Y' guidance. An agent seeing read_files_batch or list_tree alongside it must infer that this tool is for a single known path.

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