Skip to main content
Glama

Get File Contents

get_file_contents
Read-onlyIdempotent

Read file contents or list directory entries from a GitHub repository at a specified git ref without cloning. Decode Base64 file contents into UTF-8 plain text for source code inspection.

Instructions

Read current file contents or list directory entries from a repository at a specified git ref without cloning. Automatically decodes Base64 file contents into plain text UTF-8 in 'decoded_content'. Eager daily driver tool for inspecting source code, configuration files, and directory layouts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
refNoGit reference (branch name, tag, or commit SHA) to read from (default: default branch / HEAD)
pathYesRelative path to file or directory in repository (e.g. 'README.md', 'src/index.js', or '' for root)
repoYesRepository name (e.g. 'Hello-World' or 'mcp-github')
ownerYesRepository owner (user or organization, e.g. 'octocat' or 'buggycode')

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv2.1.0
    • changedInput schema / properties / path / description
      Previous value: -"Path to the file or directory in repository (e.g. 'README.md' or 'src/index.js')"New value: +"Relative path to file or directory in repository (e.g. 'README.md', 'src/index.js', or '' for root)"
    • changedInput schema / properties / ref / description
      Previous value: -"Branch name, tag, or commit SHA (default: default branch / HEAD)"New value: +"Git reference (branch name, tag, or commit SHA) to read from (default: default branch / HEAD)"
  2. First observedv1.0.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare the safe read-only, idempotent, non-destructive profile, so the bar is lower. The description still adds real value by disclosing that no clone is required and that Base64 payloads are auto-decoded into a 'decoded_content' field, which materially affects how the agent consumes the result.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three dense sentences that are front-loaded with the core capability before the decoding detail and usage framing. 'Eager daily driver tool' is mildly promotional filler, but everything else earns its place.

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 no output schema, the description partially compensates by naming the 'decoded_content' return field and the directory-listing mode. Combined with the annotations and full schema coverage, an agent has enough to call it correctly, though pagination and error behavior are unmentioned.

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 all four parameters (owner, repo, path, ref) are already documented with examples and defaults. The description reinforces the dual file/directory semantics of 'path' and the ref concept but adds no syntax or format detail beyond the schema, so the baseline 3 applies.

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 (read/list) and resource (repository file or directory) at a git ref, and covers both operating modes explicitly. An agent can immediately distinguish it from get_repository (metadata) and get_commit (history) without opening any 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 concrete usage context ('inspecting source code, configuration files, and directory layouts') and labels itself a frequent 'daily driver' tool, which tells the agent this is the default choice for reading repo content. It stops short of naming when NOT to use it or pointing at a sibling alternative.

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