get_code_context
Retrieve code context around specified file paths and line numbers to verify if a change affects them. Supports batch mode for checking multiple locations in one call.
Instructions
获取代码上下文,帮助判断命中处是否真正受变更影响。支持两种模式:单点(file_path + line_number)或批量(locations 数组,推荐——验证多个命中时一次调用替代多次往返)。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | No | 单点模式:文件路径;可传扫描结果中的相对路径(需同时传 project_path)或绝对路径 | |
| locations | No | 批量模式:[{file_path, line_number}] 数组,一次返回多段上下文 | |
| line_number | No | 单点模式:目标行号(从 1 开始) | |
| project_path | No | 项目根目录绝对路径;file_path 为相对路径时必传 | |
| context_lines | No | 前后各显示行数,默认 6 |