Skip to main content
Glama

Get file contents

get_file_contents
Read-only

Read a single file from a GitHub repository, or list folder contents when a directory path is provided, with optional branch, tag, or commit selection.

Instructions

Read one file from a repository (e.g. 'pom.xml', 'package.json', 'src/main.go'). If the path is a folder, lists its contents instead.

Input Schema

NameRequiredDescriptionDefault
refNoBranch, tag or commit SHA (default: the default branch)
pathYesFile or folder path, e.g. 'package.json'
repoYesRepository name, e.g. 'spring-boot'
ownerYesRepository owner (user or organization), e.g. 'spring-projects'
max_charsNoMaximum characters to return (default 20,000)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.2

TDQS

A3.5/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true and openWorldHint=true, so the safety profile is known. The description adds one genuinely valuable behavior, that a folder path returns a listing rather than an error, but says nothing about truncation with max_chars, binary files, or missing-path handling.

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 short sentences, front-loaded with the primary action and immediately followed by the one non-obvious branch. Nothing is wasted and no restatement of the title.

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?

With no output schema, the description should say something about what is returned: truncation via max_chars (default 20,000, max 200,000), binary/large file handling, or encoding. The folder-listing behavior is covered, but return-shape behavior is left entirely to the schema.

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 ref, path, owner, repo and max_chars are already documented; the description only echoes path semantics with examples. Baseline 3 applies since the schema carries the parameter burden.

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 one file from a repository') and grounds it with concrete path examples like 'pom.xml' and 'src/main.go'. The added note that a folder path yields a listing distinguishes it from the tree/search siblings, though no sibling is named explicitly.

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 rather than stated: fetch a file by path, and folder paths fall back to listing. There is no explicit guidance on when to prefer get_repo_tree or search_code instead, so the agent must infer the boundary from sibling names.

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