Skip to main content
Glama

Get a GitHub file

github_get_file_contents
Read-only

Read the contents of a text file from a repository you can access with a GitHub connection (your own or one shared with you). Returns the decoded file text. Optionally specify a branch, tag, or commit ref.

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": {
      "repo": "<repo>",
      "path": "<path>"
    },
    "name": "github_get_file_contents"
  }
}

Input Schema

NameRequiredDescriptionDefault
refNoOptional branch, tag, or commit SHA.
pathYesPath to the file within the repository.
repoYesRepository in "owner/repo" form, e.g. octocat/Hello-World. The owner is the GitHub LOGIN exactly as it appears in the repository URL (github.com/<owner>/<repo>) — not a display name, and not the connection's name.
connectionNoWhich GitHub connection to use, by its name from github_list_connections. This is a local label for the connection, NOT a GitHub username — for anything GitHub has to resolve, use that connection's login instead. Optional when you have exactly one.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.6/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, and openWorldHint=false, so the safety profile is covered. The description adds real value by promising decoded text output and noting the access model (own or shared connection). It stays silent on what happens for directories, binary files, or oversized files, which are the main failure modes for a GitHub contents endpoint.

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 short sentences, front-loaded with the action and followed by the return value and the optional ref. No filler, no repetition of what the schema already says at length.

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 correctly compensates by stating that decoded file text is returned. For a simple read-only, four-parameter tool this covers what an agent needs to call it correctly. Minor gap: no mention of error or edge-case behavior for non-file paths.

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%, and the schema descriptions for repo, path, ref, and connection are already unusually detailed. The description's only parameter contribution is restating that ref can be a branch, tag, or commit, so it neither adds nor conflicts with the schema. Baseline 3 applies.

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?

States a specific verb and resource: "Read the contents of a text file from a repository," and adds the scope of accessible repos. It implicitly separates itself from github_search_code by focusing on reading a known path, but it never names that sibling or any other, so differentiation is left to inference.

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?

Usage is implied by "a repository you can access with a GitHub connection (your own or one shared with you)," which hints at the connection prerequisite. There is no explicit guidance on when to prefer this over github_search_code, github_list_repositories, or how to resolve a path before calling, and no stated exclusions.

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