Get file contents
get_file_contentsRead a single file from a GitHub repository, or list folder contents when a directory path is provided, with optional branch, tag, or commit selection.
Instructions
Read one file from a repository (e.g. 'pom.xml', 'package.json', 'src/main.go'). If the path is a folder, lists its contents instead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | No | Branch, tag or commit SHA (default: the default branch) | |
| path | Yes | File or folder path, e.g. 'package.json' | |
| repo | Yes | Repository name, e.g. 'spring-boot' | |
| owner | Yes | Repository owner (user or organization), e.g. 'spring-projects' | |
| max_chars | No | Maximum characters to return (default 20,000) |