treesitter_get_source_for_range
Extract the source code text for a specified line and column range from a file. Optionally write the result to an output file to avoid large responses.
Instructions
Extract the source code text for a given line/column range.
Args: file_path: Path to the source code file start_row: Starting line number (0-based) start_column: Starting column number (0-based) end_row: Ending line number (0-based) end_column: Ending column number (0-based) output_file: If provided, writes result to this file instead of returning. Useful for large outputs to prevent context overload.
Returns: Dictionary containing: - file_path: The analyzed file path - range: The requested range - source: The extracted source code text OR if output_file is set: {"status": "written", "output_file": "...", "bytes_written": N}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end_row | Yes | ||
| file_path | Yes | ||
| start_row | Yes | ||
| end_column | Yes | ||
| output_file | No | ||
| start_column | Yes |