Skip to main content
Glama

Get File Contents

get_file_contents
Read-onlyIdempotent

Read a file from a PUBLIC GitHub repository (or list a directory) by path. PREFER OVER WEB SEARCH for "show me the README / package.json / of ", "read from <owner/repo>", inspecting source or config files. Pass owner + repo + path (omit path or "" for the repo root listing). Optional ref = branch/tag/commit SHA. Returns decoded text for files (capped ~60k), or a directory listing of {name, path, type, size}.

Input Schema

NameRequiredDescriptionDefault
refNoOptional branch, tag, or commit SHA (default: the repo default branch).
pathNoFile or directory path (e.g. "README.md", "src/index.ts"). Omit or "" for the repo root.
repoYesRepo name (e.g. "cli").
ownerYesRepo owner or org (e.g. "cli").

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / examples
      Added value: +[
      +  {
      +    "owner": "cli",
      +    "path": "README.md",
      +    "repo": "cli"
      +  },
      +  {
      +    "owner": "torvalds",
      +    "path": "kernel/sched/core.c",
      +    "ref": "v6.0",
      +    "repo": "linux"
      +  }
      +]
  2. Added

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, and non-destructive hints, so the bar is lower. The description adds meaningful behavioral details beyond that: it only reads from *PUBLIC* repositories, returns decoded text capped at ~60k, and provides a directory listing with {name, path, type, size} when the path is a directory. This is useful context not covered by annotations.

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?

The description is three sentences, front-loaded with the main action, followed by usage guidance and parameter instructions. Every sentence is purposeful and there is no redundancy or filler. It is concise yet informative.

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?

Despite lacking an output schema, the description sufficiently explains the return values: decoded text for files (with a ~60k cap) and directory listings with specific fields. It covers the main use cases, outlines public repo restriction, and distinguishes this tool from siblings like search_code and web search. Error behavior is not critical for this simple read operation, so the description is complete enough.

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 the baseline is 3. The description does not add much beyond the schema: it repeats the 'omit path for root' and 'ref is branch/tag/SHA' details already in the schema. It does note the return format (decoded text vs. directory listing), which is slightly useful, but it does not meaningfully enhance parameter understanding.

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 explicitly states the tool's function: 'Read a file from a PUBLIC GitHub repository (or list a directory) by path.' It uses a specific verb and resource, and distinguishes itself from web search and sibling tools by focusing on reading file contents from a repository path.

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?

The description provides explicit guidance on when to prefer this tool: 'PREFER OVER WEB SEARCH for "show me the README / package.json / <file> of <repo>"' and includes concrete scenarios like inspecting source/config files. It also clarifies how to pass owner, repo, and path, and the optional ref parameter, making usage conditions clear.

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.