Github Get Repository File
github_get_repository_fileReads a single repository file at a chosen ref, using byte limits and offsets to return partial content with a next offset for continuation.
Instructions
Reads one file from a repository at ref, windowed to limit bytes from offset. bytes_total is the whole file either way and next_offset says where to carry on, so a partial read never passes for the lot. A directory is listed through github_api_read instead. See #409.
Workflow and conventions: github_get_skill('pr-analysis').
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"repo_owner": "<repo_owner>",
"repo_name": "<repo_name>",
"path": "<path>"
},
"name": "github_get_repository_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | No | Branch, tag or SHA to read at. Omit for the default branch | |
| path | Yes | File path from the repository root, e.g. src/mcp_github/auth.py | |
| limit | No | Cap on the bytes returned. Pass 0 to learn the size without reading | |
| offset | No | Byte to start the window at. Pass a previous next_offset to carry on | |
| repo_name | Yes | ||
| repo_owner | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | Yes | ||
| path | Yes | ||
| binary | Yes | ||
| content | Yes | ||
| truncated | Yes | ||
| bytes_total | Yes | ||
| next_offset | Yes | ||
| bytes_returned | Yes |