Skip to main content
Glama

get_file_contents

Retrieve file contents or directory listings from GitHub repositories. Specify owner, repo, and path to access structured JSON data with type information for consistent parsing.

Instructions

Get the contents of a file or directory listing in a repository. Returns JSON with a 'type' field ('file' or 'directory') for consistent parsing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYesRepository owner
repoYesRepository name
pathYesFile path in the repository
refNoBranch name, tag, or commit SHA (defaults to default branch)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It adds some behavioral context: it specifies that the tool returns JSON with a 'type' field for consistent parsing, which helps understand the output structure. However, it lacks details on error handling, rate limits, authentication needs, or whether it's a read-only operation (though 'Get' implies reading). For a tool with no annotations, this is a moderate but incomplete disclosure.

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 very concise and well-structured: two sentences that directly state the purpose and output format, with no wasted words. It's front-loaded with the core functionality, making it easy to parse quickly. Every sentence adds value without redundancy.

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?

Given the context: no annotations, 4 parameters with full schema coverage, and an output schema (implied by 'Returns JSON'), the description is reasonably complete. It covers the basic purpose and output structure, which is sufficient for a read operation. However, it could be more complete by addressing authentication or error scenarios, but the output schema likely handles return values, so this isn't critical.

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?

The input schema has 100% description coverage, so the schema already documents all parameters (owner, repo, path, ref) thoroughly. The description doesn't add any parameter-specific details beyond what's in the schema, such as examples or edge cases. According to the rules, with high schema coverage, the baseline is 3, which is appropriate here as the description doesn't compensate but doesn't need to.

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 clearly states the tool's purpose: 'Get the contents of a file or directory listing in a repository.' This specifies the verb ('Get') and resource ('contents of a file or directory listing'), making it easy to understand. However, it doesn't explicitly differentiate from sibling tools like 'get_repository_tree' or 'get_gist', which might have overlapping functionality in a GitHub context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With many sibling tools like 'get_repository_tree', 'get_gist', and 'get_file' (implied by context), there's no indication of specific use cases, prerequisites, or exclusions. This leaves the agent to infer usage based on the tool name alone.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/software-engineer-mj/github-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server