Skip to main content

Get repository content

The GitHub Get repository content tool retrieves files and folders from a GitHub repository at a specific path, branch, or commit reference. Use this read-only tool to inspect code structure, documentation, or directory listings for analysis, summaries, or onboarding content generation.

Replace deprecated GitHub tools​

Use Get file or directory contents (GitHub MCP) (get_file_contents) instead of the deprecated githubreadfilefrombranch tool.

Limitations​

  • Access can get blocked by GitHub organization OAuth App access restrictions, returning a 403 error even when credentials are correct.

Prerequisites​

  • Your admin must install and configure the GitHub connector, add GitHub tools under Admin console → Platform → Tools, and enable this tool.

  • A GitHub app must be installed on the relevant organization(s) and linked to the correct GitHub connector in the Glean Admin console.

  • You must authenticate for GitHub tools so the tool can run using your GitHub identity.

Supported parameters​

NameTypeDescription
OwnerStringRepository owner.
RepositoryStringRepository name.
File pathStringFile or folder path within the repository.
Branch or commitStringBranch or commit reference to read content from.

Usage example​

You want to create onboarding documentation for new contributors by examining the structure of the project's documentation directory.

Instruction to an agent:

"Show me all files in the docs/ directory of the mycompany/backend repository on the main branch."

Resulting behavior:

  • Calls Get repository content with:

    • Owner set to "mycompany".

    • Repository set to "backend".

    • File path set to "docs/".

    • Branch or commit set to "main".

  • Retrieves repository content including:

    • List of files in the docs/ directory

    • File names and paths

    • File types (file vs directory)

    • File sizes

    • Download URLs for each file

  • Presents the directory structure to the user.

  • User can review the documentation files and decide which ones to include in the onboarding guide.

Workflow tip: Use this tool to inspect repository structure before generating documentation or onboarding content. You can specify a branch or commit SHA to view content at a specific point in history. For private repositories, ensure the GitHub app has proper access permissions.

Troubleshooting​

FAQs​