Skip to main content
Glama

get_repository_tree

Read-only

List files and directories in a GitLab repository by path, branch, or tag. Get recursive tree or paginated results to inspect project structure.

Instructions

List files and directories in a repository. 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
refNoThe name of a repository branch or tag. Defaults to the default branch.
pathNoThe path inside the repository
jmespathNoOptional JMESPath expression filtering the JSON result before return.
per_pageNoNumber of results to show per page
recursiveNoBoolean value to get a recursive tree
page_tokenNoToken for keyset pagination. Use the next_page_token value returned in the previous response to retrieve the next page.
paginationNoPagination method. Use 'keyset' for keyset-based pagination (required for repositories with many files). Non-keyset calls keep the legacy array response for backward compatibility; that legacy response shape is deprecated and may be removed in a future major release. Keyset calls return a structured response with items and next_page_token when more pages are available.
project_idYesThe ID or URL-encoded path of the project

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.45
  3. Removedv2.1.43
  4. Addedv2.1.18
  5. Removedv2.1.14
  6. Addedv2.1.11
  7. Removedv2.1.10
  8. Changed4 schema fields changedv2.1.9
    • removedInput schema / additionalProperties
      Removed value: -false
    • changedInput schema / properties / page_token / description
      Previous value: -"The tree record ID for pagination"New value: +"Token for keyset pagination. Use the next_page_token value returned in the previous response to retrieve the next page."
    • changedInput schema / properties / pagination / description
      Previous value: -"Pagination method (keyset)"New value: +"Pagination method. Use 'keyset' for keyset-based pagination (required for repositories with many files). Non-keyset calls keep the legacy array response for backward compatibility; that legacy response shape is deprecated and may be removed in a future major release. Keyset calls return a structured response with items and next_page_token when more pages are available."
    • addedInput schema / required
      Added value: +[
      +  "project_id"
      +]
  9. First observedv1.0.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already provide readOnlyHint and openWorldHint, lowering the bar. The description adds valuable context by confirming no mutation and enumerating error conditions (missing resources, invalid identifiers, insufficient permission, rate limits), which goes beyond the 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 four sentences, each serving a distinct purpose: action, usage guidance, behavioral transparency, and parameter handling. It is front-loaded with the primary purpose and contains no filler.

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?

For a tool with 8 parameters, 100% schema coverage, annotations, and no output schema, the description adequately covers purpose, usage, safety, and error behavior. Minor gaps: the unsupported reference to group_id could confuse, and it does not explicitly describe the return structure, but the schema and clear purpose compensate.

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 the schema already documents all parameters; the description only reinforces how to provide project_id/path and pagination. The mention of 'group_id' is extraneous since it is not in this schema, but it does not materially harm parameter understanding.

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 action and resource: 'List files and directories in a repository.' It also differentiates from discovery-focused siblings by advising to use other list or search tools when discovering multiple resources, making the tool's niche clear.

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 says to use this tool for a known resource or result and to choose 'the corresponding list or search tool' when discovery is needed. It also instructs to use required identifiers and pagination fields exactly as documented, giving actionable usage direction.

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

Deploy Server

Other Tools