codecodebase analysis / get file

Get File

get_file

Fetches the content of a specific file from a GitHub repository. Token optional for public repos; required for private repos. Use when: user wants to read a known file from a GitHub repo by its path — e.g. 'show me the README', 'get the handler.py from owner/repo'. Scope: remote GitHub file fetch only. Requires knowing the exact file path. Not for: searching for files by pattern (use search_code), local file reading (use standard file tools), or repo structure overview (use get_repo_info).

How to use get_file

Provide only the required inputs below. Start with the smallest scope that answers the task, then review the risk properties before an agent executes the call.

Risk and execution properties

Read only: yes

Destructive: no

Idempotent: yes

Open world: yes — can reach external systems

Inputs

repostringrequired

GitHub repo in 'owner/repo' format. Example: 'agenticstore/agentic-store-mcp'

file_pathstringrequired

Path to the file within the repository. Example: 'README.md', 'src/handler.py'

refstring

Branch, tag, or commit SHA to fetch from. Default: repo's default branch (usually 'main' or 'master').

Default: "main"

Example input

{
  "repo": "<string>",
  "file_path": "<string>",
  "ref": "main"
}

Browse or search the full 74-tool reference to choose the smallest suitable capability.

Browse all tools →