treesitter_find_variable
Find variable declarations and usages by name in source code. Locate every reference, with optional source snippets, to analyze or debug quickly.
Instructions
Search for variable declarations and usages by name.
Args: file_path: Path to the source code file name: Name of the variable to find include_source: If True, includes the source code for each matched variable. output_file: If provided, writes result to this file instead of returning. Useful for large outputs to prevent context overload.
Returns: Dictionary containing: - query: The search query (variable name) - matches: List of Symbol objects representing variable declarations and usages. If include_source is True, each match includes a "source" field. OR if output_file is set: {"status": "written", "output_file": "...", "bytes_written": N}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| file_path | Yes | ||
| output_file | No | ||
| include_source | No |