Skip to main content
Glama

gitlab_get_file

Read-onlyIdempotent

Retrieve the contents of a text file from a GitLab repository, limited to 500 lines, by specifying the file path and optionally the branch or tag.

Instructions

Read a text file from the repository, truncated to 500 lines.

For binaries, gets decoded as UTF-8 with errors replaced — you will likely get garbage; use for text content only.

Examples: - "Show me .gitlab-ci.yml on master" → file_path='.gitlab-ci.yml' - "Read src/app.py from the release-1.2 tag" → file_path='src/app.py', ref='release-1.2' - Don't use for listings — use gitlab_list_repository_tree.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYesPath to the file from the repo root (e.g. 'src/app.py').
refNoBranch, tag or commit SHA.master
project_pathNoGitLab project path (e.g. 'my-org/my-repo'). When omitted, the default from GITLAB_PROJECT_PATH env var is used.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes
refYes
sizeYes
total_linesYes
truncatedYes
contentYes
Behavior5/5

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

Beyond annotation signals (readOnly, idempotent, openWorld), the description discloses truncation to 500 lines and binary decoding behavior (UTF-8 with errors replaced leading to garbage). This adds valuable behavioral context without contradicting annotations.

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: two short paragraphs plus bulleted examples. The first sentence delivers the core purpose and key constraint (truncation). Every sentence adds necessary information with no fluff.

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?

For a tool with 3 parameters (1 required) and an output schema, the description covers purpose, usage limits, binary caveats, when to avoid, and parameter examples. It is fully self-contained for correct selection and invocation.

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 100%, so baseline is 3. The description adds value with direct examples mapping intents to parameters (e.g., file_path='src/app.py') and clarifies that project_path defaults from environment when omitted, surpassing the schema's mere default null.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Read a text file from the repository, truncated to 500 lines,' which is a specific verb+resource. It also contrasts with binary usage and explicitly distinguishes from the sibling tool gitlab_list_repository_tree, ensuring no confusion.

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

Usage Guidelines5/5

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

The description explicitly says 'Don't use for listings — use gitlab_list_repository_tree,' providing a clear when-not-to-use and alternative. Examples illustrate typical usage, guiding the AI on how to map natural language to parameters.

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/mshegolev/gitlab-ci-mcp'

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