treesitter_find_usage
Find all usages and references of a symbol in a source file. Automatically detects the language or accepts an override, and can write large outputs to a file.
Instructions
Find all usages/references of a symbol (identifier) in a source file.
Args: name: Symbol name to search for file_path: Path to the source code file language: Optional language override (auto-detected from file extension if not provided) 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 (symbol name) - matches: List of Symbol objects representing all usages of the symbol OR if output_file is set: {"status": "written", "output_file": "...", "bytes_written": N}
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"name": "<name>",
"file_path": "<file_path>"
},
"name": "treesitter_find_usage"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| language | No | ||
| file_path | Yes | ||
| output_file | No |