fetch_repository_file
Fetch the content of a source code file from a GitHub repository, with optional start and end line numbers to extract specific sections. Ideal for reading code or configuration files.
Instructions
获取仓库内的源代码文件内容。
读取指定仓库中的文件内容,支持按行号范围截取。 内部自动通过 repo_path 获取 repo_id。 适用于查看源代码、配置文件等。
示例:
获取完整文件: fetch_repository_file("owner/repo", "src/config.ts")
获取前 50 行: fetch_repository_file("owner/repo", "src/config.ts", 1, 51)
从第 100 行到末尾: fetch_repository_file("owner/repo", "src/config.ts", 100)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repo_path | Yes | 仓库路径,格式: owner/repo 或完整 URL | |
| file_path | Yes | 文件在仓库中的路径,如 "src/config.ts", "README.md" | |
| start_line | No | 可选,开始行号(包含),从 1 开始计数 | |
| end_line | No | 可选,结束行号(不包含),不指定则到文件末尾 |