Get File Contents
get_file_contentsRead file contents, extract symbol outlines, slice line ranges, or list directory entries from a GitHub repository at a git ref without cloning. Automatically decodes Base64 to UTF-8.
Instructions
Read current file contents, extract symbol outlines, slice line ranges, or list directory entries from a repository at a specified git ref without cloning. Automatically decodes Base64 file contents into plain text UTF-8. Eager daily driver tool for inspecting source code, configuration files, and directory layouts.
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": {
"owner": "<owner>",
"repo": "<repo>",
"path": "<path>",
"outline_only": "<outline_only>"
},
"name": "get_file_contents"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | No | Git reference (branch name, tag, or commit SHA) to read from (default: default branch / HEAD) | |
| path | Yes | Relative path to file or directory in repository (e.g. 'README.md', 'src/index.js', or '' for root) | |
| repo | Yes | Repository name (e.g. 'Hello-World' or 'mcp-github') | |
| owner | Yes | Repository owner (user or organization, e.g. 'octocat' or 'buggycode') | |
| end_line | No | Optional 1-based end line to slice file contents | |
| start_line | No | Optional 1-based start line to slice file contents | |
| outline_only | Yes | Extract top-level symbol signatures (functions, classes, interfaces, types) with line numbers to conserve tokens (default: false) |