Skip to main content
Glama

get_file_contents

Read-only

Retrieve file or directory contents from a GitLab project by specifying project, path, and ref. Use when you know the exact resource; errors indicate missing permissions, invalid identifiers, or rate limits.

Instructions

Get contents of a file or directory from a GitLab project. Use this for a known resource or result; choose the corresponding list or search tool when you need to discover multiple resources. It is read-only and does not mutate GitLab data; missing resources, invalid identifiers, insufficient permission, and rate limits are returned as errors. When project_id or group_id is accepted, provide the numeric ID or complete URL-encoded path described by the schema; use required identifiers and pagination fields exactly as documented.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
refNoBranch/tag/commit to get contents from
pathNoAlias of file_path
file_pathNoPath to the file or directory. Takes precedence over 'path' when both are provided
project_idNoProject ID or URL-encoded path (optional; falls back to env)
Install Server

TDQS

A4.7/5.0
Behavior4/5

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

Beyond the readOnlyHint annotation, the description specifies that it does not mutate data and lists common error conditions (missing resources, invalid identifiers, insufficient permission, rate limits), giving concrete behavioral expectations.

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 compact, with the core purpose stated first, followed by targeted usage guidance and error behavior. No redundant or tangential information is present.

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 simple get operation with no output schema, the description covers purpose, usage, error conditions, and parameter guidance adequately. The schema's mention of 'file_path' precedence is present, so no critical gaps exist.

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?

While the schema already includes descriptions for each parameter, the description adds guidance on how to provide identifiers (e.g., numeric ID or URL-encoded path) and mentions using required identifiers and pagination fields, which adds practical usage context.

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 the verb 'get' and the resource 'contents of a file or directory from a GitLab project', and explicitly contrasts with list/search tools for discovery, making the purpose unambiguous.

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?

It explicitly instructs to use this tool when the resource is known, and to choose list/search tools for discovery, providing clear decision criteria relative to sibling tools.

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

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

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