get_repository_tree
List files and directories in a GitLab project repository to view its structure and contents.
Instructions
Get the repository tree for a GitLab project (list files and directories)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | The ID or URL-encoded path of the project | |
| path | No | The path inside the repository | |
| ref | No | The name of a repository branch or tag. Defaults to the default branch. | |
| recursive | No | Boolean value to get a recursive tree | |
| per_page | No | Number of results to show per page | |
| page_token | No | The tree record ID for pagination | |
| pagination | No | Pagination method (keyset) |
Implementation Reference
- schemas.ts:382-393 (schema)Input schema (GetRepositoryTreeSchema) for the 'get_repository_tree' tool, which validates the parameters for fetching the repository tree from GitLab API.export const GetRepositoryTreeSchema = z.object({ project_id: z.string().describe("The ID or URL-encoded path of the project"), path: z.string().optional().describe("The path inside the repository"), ref: z .string() .optional() .describe("The name of a repository branch or tag. Defaults to the default branch."), recursive: z.boolean().optional().describe("Boolean value to get a recursive tree"), per_page: z.number().optional().describe("Number of results to show per page"), page_token: z.string().optional().describe("The tree record ID for pagination"), pagination: z.string().optional().describe("Pagination method (keyset)"), });
- schemas.ts:395-398 (schema)Response schema (GitLabTreeSchema) defining the structure of the repository tree returned by the 'get_repository_tree' tool.export const GitLabTreeSchema = z.object({ id: z.string(), // Changed from sha to match GitLab API tree: z.array(GitLabTreeItemSchema), });
- schemas.ts:374-380 (schema)Schema for individual tree items (files/directories) used in the repository tree response of the 'get_repository_tree' tool.export const GitLabTreeItemSchema = z.object({ id: z.string(), name: z.string(), type: z.enum(["tree", "blob"]), path: z.string(), mode: z.string(), });
- schemas.ts:1370-1370 (helper)Type definition for the input options of the 'get_repository_tree' tool derived from its Zod schema.export type GetRepositoryTreeOptions = z.infer<typeof GetRepositoryTreeSchema>;