Skip to main content
Glama

Get file or directory contents

get_file_contents
Read-only

Read a file from a Forgejo/Gitea repository as text or list directory contents; an empty path lists the repo root, and file reads return the blob SHA needed for updates.

Instructions

Read a file (decoded to text) or list a directory. Use path '' for the repository root. File results include the blob sha needed to update the file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
refNoBranch, tag or commit SHA (default: repo default branch)
pathNo
repoYesRepository name
ownerYesRepository owner (user or organization)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false and openWorldHint=true, so the safety profile is covered. The description still adds value beyond structured data: it discloses that file content is decoded to text and that file results carry the blob `sha` needed for a subsequent update — critical chaining information absent from annotations and schema (no output schema exists).

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, each earning its place: the core capability first, then the root-path edge case, then the return-value hook for updating files. Nothing is repeated from the title or annotations.

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

Completeness5/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 still communicates the shape of results (decoded text, directory listing, blob sha) and the path default, which is enough for an agent to call it correctly. Minor omissions (binary/non-text file handling, directory listing format) are not blocking for this read-only tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 75%; the only undocumented parameter is `path`, and the description specifically explains its semantics (empty string = repository root). The other three parameters are already documented in the schema, so the description adds meaning precisely where the gap is.

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 concrete verb+resource pair ('Read a file... or list a directory') and even clarifies the dual-mode behavior, which tells an agent immediately what it returns. It does not explicitly distinguish itself from siblings like get_repository or list_branches, but the file-vs-directory scope is unambiguous.

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?

The note 'Use path \'\' for the repository root' is a real usage instruction for an edge case, and the mention of the blob `sha` implies a follow-up workflow (pairs with create_or_update_file). However, there is no explicit statement of when to prefer this tool over alternatives or what preconditions apply.

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