Skip to main content
Glama

get_file_contents

Read-only

Retrieve file or directory contents from a GitLab project by specifying the project, path, and optional branch, tag, or commit reference.

Instructions

Get contents of a file or directory from a GitLab project.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "get_file_contents"
  }
}

Input Schema

NameRequiredDescriptionDefault
refNoBranch/tag/commit to get contents from
pathNoAlias of file_path
jmespathNoOptional JMESPath expression filtering the JSON result before return.
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)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv2.1.66
    • addedInput schema / properties / jmespath
      Added value: +{
      +  "description": "Optional JMESPath expression filtering the JSON result before return.",
      +  "type": "string"
      +}
  2. Addedv2.1.18
  3. Removedv2.1.14
  4. Addedv2.1.11
  5. Removedv2.1.10
  6. Changed5 schema fields changedv2.1.9
    • removedInput schema / additionalProperties
      Removed value: -false
    • changedInput schema / properties / file_path / description
      Previous value: -"Path to the file or directory"New value: +"Path to the file or directory. Takes precedence over 'path' when both are provided"
    • addedInput schema / properties / path
      Added value: +{
      +  "description": "Alias of file_path",
      +  "type": "string"
      +}
    • changedInput schema / properties / project_id / description
      Previous value: -"Project ID or complete URL-encoded path to project"New value: +"Project ID or URL-encoded path (optional; falls back to env)"
    • removedInput schema / required
      Removed value: -[
      -  "file_path"
      -]
  7. First observedv1.0.0

TDQS

C2.9/5.0
Behavior2/5

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

Annotations already declare readOnlyHint=true and openWorldHint=true, so safety is covered. The description adds no behavioral context at all: it doesn't say what happens when path points at a directory (listing vs error), what happens if ref is omitted, or whether large files are truncated.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single well-formed sentence with zero filler and the resource front-loaded. It is efficient, though its brevity comes at the cost of the missing usage and behavioral detail noted elsewhere.

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

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The rich schema covers parameters and the annotations cover safety, but with five parameters, no required fields, and no output schema, the description should clarify the file-vs-directory return shape and default ref behavior. As written it is minimally adequate rather than complete.

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%, so all five parameters (including the path/file_path precedence rule and the project_id env fallback) are already documented in the schema. The description contributes nothing parameter-specific, so the baseline 3 applies.

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 specific verb and resource ('Get contents of a file or directory') scoped to a GitLab project, which is enough to distinguish it from most siblings like get_file_blame or get_repository_tree. It stops short of explicitly naming how it differs from those adjacent tools, so a 4 rather than a 5.

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?

There is no when-to-use or when-not-to-use guidance, and no alternatives are named even though get_file_blame, get_repository_tree, and get_commit_diff all overlap in scope. The agent must infer selection purely from the tool name.

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