treesitter_get_node_for_range
Identify the smallest AST node covering a range in code, specified by start/end rows and columns.
Instructions
Return the smallest AST node covering a point range.
Args: file_path: Path to the source code file start_row: Starting row (0-based) start_column: Starting column (0-based) end_row: Ending row (0-based) end_column: Ending column (0-based) max_depth: Maximum depth of the AST to return. 0 for just the node. output_file: If provided, writes result to this file instead of returning. Useful for large outputs to prevent context overload.
Returns: AST node as dictionary 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 | ||
| max_depth | No | ||
| start_row | Yes | ||
| end_column | Yes | ||
| output_file | No | ||
| start_column | Yes |