Get File Contents
get_file_contentsRead raw file or directory tree contents from a GitLab repository at a branch, tag, or commit to inspect source code and configuration files.
Instructions
Read the raw content of a specific file or directory tree from a repository at a designated branch, tag, or commit ref. Use when inspecting current repository source code or configs. Do NOT use for reviewing diffs between branches (use 'get_merge_request_changes') or viewing commit diffs (use 'get_commit').
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | No | Branch name, tag, or commit SHA (default: default branch / HEAD) | |
| end_line | No | Optional 1-based end line to slice content | |
| file_path | Yes | Path to the file or directory in repo (e.g. 'pom.xml', 'docs/README.md', or 'src' for directory tree) | |
| project_id | Yes | Project numeric ID (e.g. 31) or namespace path (e.g. 'group/project-name'). URL-encoding is handled automatically. | |
| start_line | No | Optional 1-based start line to slice content | |
| outline_only | Yes | When true, extract and return only high-level symbol declarations (classes, functions, interfaces, methods, types) with their line numbers instead of full content (default: false) |