Skip to main content
Glama

Gitlab Get File

gitlab_get_file
Read-onlyIdempotent

Fetch file content from a GitLab repository by project ID and file path (e.g., "src/main.py"). Returns decoded content, file size, name, and encoding.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
refNoBranch, tag, or commit SHA (default: default branch)
_apiKeyYesGitLab personal access token
file_pathYesPath to the file within the repository
project_idYesProject ID (numeric) or full path "namespace/project" (e.g. "gitlab-org/gitlab") — pass the plain path, do not URL-encode it.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
refYesGit ref (branch/tag/commit)
sizeYesFile size in bytes
contentYesDecoded file content
file_nameYesFile name
file_pathYesFile path in repository
last_commitYesLast commit SHA

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / project_id / description
      Previous value: -"Project ID or URL-encoded path"New value: +"Project ID (numeric) or full path \"namespace/project\" (e.g. \"gitlab-org/gitlab\") — pass the plain path, do not URL-encode it."
  2. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "content": {
      +      "description": "Decoded file content",
      +      "type": "string"
      +    },
      +    "file_name": {
      +      "description": "File name",
      +      "type": "string"
      +    },
      +    "file_path": {
      +      "description": "File path in repository",
      +      "type": "string"
      +    },
      +    "last_commit": {
      +      "description": "Last commit SHA",
      +      "type": "string"
      +    },
      +    "ref": {
      +      "description": "Git ref (branch/tag/commit)",
      +      "type": "string"
      +    },
      +    "size": {
      +      "description": "File size in bytes",
      +      "type": "number"
      +    }
      +  },
      +  "required": [
      +    "file_name",
      +    "file_path",
      +    "size",
      +    "ref",
      +    "last_commit",
      +    "content"
      +  ],
      +  "type": "object"
      +}
  3. Changed1 schema field changed
    • addedInput schema / examples
      Added value: +[
      +  {
      +    "_apiKey": "your-gitlab-api-key",
      +    "file_path": "README.md",
      +    "project_id": "123"
      +  },
      +  {
      +    "_apiKey": "your-gitlab-api-key",
      +    "file_path": "src/main.py",
      +    "project_id": "123",
      +    "ref": "develop"
      +  }
      +]
  4. First observed

TDQS

A4/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, and non-destructive behavior. The description adds value by specifying the return payload (decoded content, file size, name, encoding), which goes beyond the annotations. It does not cover edge cases or error handling, but the added output details merit a 4.

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 a single, well-structured sentence that front-loads the core action ('Fetch file content') and includes a concrete example. There is zero redundancy or fluff; every word earns its place.

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?

The tool has an output schema, full schema parameter descriptions, and annotations covering safety. The description adds return details and an example, making the definition largely complete for a read-only file fetch. It lacks error-condition or rate-limit notes, but those are secondary for this simple operation.

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%, and each parameter is individually described, including ref's default and project_id's numeric/path dual format. The description reinforces the file path example but adds minimal new semantic information beyond the schema. Baseline 3 is appropriate.

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 states a specific verb and resource ('Fetch file content from a GitLab repository') with the key parameters (project ID and file path) and an example. The action is precise and differentiates it from siblings like gitlab_get_project, which returns project metadata rather than file content.

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?

There is no explicit guidance on when to use this tool versus alternatives, such as gitlab_get_project or listing tools. The purpose is clear, but the description doesn't state exclusionary conditions or mention alternative tools, leaving the choice to inference.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.