Skip to main content
Glama

GitHub (read-only): get file contents

github_readonly.get_file_contents
Read-onlyIdempotent

Read a file, or list a directory, from a GitHub repository at a branch, tag or commit.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
refNoGit commit SHA, branch name, or tag (defaults to repository default branch).
shaNoAccepts optional commit SHA. If specified, it will be used instead of ref
pathNoRelative path to file or directory in the repository (e.g. 'src/main.py')./
repoYesTarget repository name.
ownerYesRepository owner or organization name.
fieldsNoSubset of fields to return for each entry when the path is a directory. If omitted, all fields are returned. Ignored when the path is a single file. Use this to reduce response size when listing directories and you only need specific fields, e.g. just 'name' and 'type'.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

B3.4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and openWorldHint, so the safety profile is fully covered by structured data. The description adds only the branch/tag/commit framing, and omits genuinely useful behavioral context such as authentication needs, rate limits, and how file content is returned (e.g. encoding or size limits).

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?

A single front-loaded sentence with no filler; the dual file/directory behavior is stated up front. It is efficient, though the terseness leaves no room for the routing or behavior context an agent would benefit from.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a six-parameter tool with no output schema, the description is thin: it does not explain that files come back encoded, that directories return entry objects controlled by the fields parameter, or any size/error caveats. Annotations and the 100% schema coverage carry the rest, making this adequate but with real gaps.

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 all six parameters are already documented, including the ref/sha precedence and the fields filter for directory listings. The description adds no syntax, format, or precedence detail beyond what the schema provides, so the 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?

The description states a specific verb pair (read/list) and resource (file or directory in a GitHub repository), with the ref dimension (branch, tag or commit) named explicitly. It is clearly distinguishable from siblings like get_me or pull_request_read by resource, though it never names those siblings.

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 only implied: the agent can infer this is the tool for fetching repository content. There is no explicit when-to-use guidance, no mention of when this is preferable to pull_request_read, and no note on choosing between ref and sha or on path semantics ('/' vs a file).

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