get_file
Retrieve file content from a GitHub repository with line numbers, line range slicing, and substring/regex filtering. Use after code search or symbol lookup.
Instructions
Read file content from one file in a GitHub repository. Returns full file with line numbers, supports line range slicing (start_line/end_line) and substring/regex match filtering with context lines. Truncates files over 500 lines unless a range or match is specified. Use after locating a file via search_code, find_symbol, or repo_tree.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repo | Yes | Repository in 'owner/name' format (e.g. 'modelcontextprotocol/python-sdk'). | |
| path | Yes | File path within the repo. | |
| ref | No | Branch, tag, or commit SHA. Defaults to the default branch. | |
| start_line | No | First line to show (1-indexed). | |
| end_line | No | Last line to show (1-indexed, inclusive). | |
| match | No | Show only lines containing this substring (case-insensitive). Surround with / for regex. | |
| match_context | No | Context lines around each match. |