Read a file at a specific ref
get_fileRead file contents from any GitLab branch, tag, or commit without checking it out. Uses cached mirrors or your clone for read-only inspection of other refs.
Instructions
Return the contents of a file at a given branch, tag, or commit WITHOUT checking it out. Use this to inspect files on a branch other than the one currently checked out. Give either url — a GitLab web link, whose #L12-20 line anchor is honoured — or both ref and path. The repository is mirrored locally on first use and refreshed when it goes stale, or, for a project registered with add_repo, read from your own clone. The result reports the resolved commit and the last sync time. If the copy cannot be refreshed, the cached copy answers and the result says the refresh failed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | No | Branch, tag, or commit SHA, e.g. 'develop' or 'fix/PROJ-7608'. Required unless `url` is given. | |
| url | No | A GitLab web link, e.g. 'https://gitlab.example.com/group/repo/-/blob/develop/src/index.tsx#L12-20'. Replaces ref, path and (usually) project; the host must be GITLAB_HOST. | |
| path | No | File path inside the repository, forward slashes, e.g. 'src/index.tsx'. Required unless `url` is given. | |
| project | No | GitLab project path, e.g. 'group/subgroup/repo'. Defaults to GITLAB_DEFAULT_PROJECT, or to the URL's project. | |
| max_bytes | No | Maximum bytes of content to return (default 200000). Ignored when a line range is asked for, which needs the whole file. |