find_references
Find all usages of a Python symbol, including subclass references, with options to filter fields and include subclasses. Supports precise location or symbol name input.
Instructions
Python: Find ALL usages of a symbol. Understands inheritance - grep misses subclass refs.
For general use, prefer lookup() which accepts any identifier form. This tool provides fields filtering, include_subclasses, and symbol_name for full reference lists.
Two calling conventions (coordinates take precedence if both provided):
Coordinates: file + line + column (precise, unambiguous)
Symbol name: symbol_name only (convenient; fails if name is ambiguous)
If symbol_name matches multiple symbols, returns error with a "matches" list so you can pick the right one and retry with coordinates.
Args: file: Path to the file (required with line and column) line: Line number (1-indexed, required with file and column) column: Column number (0-indexed, required with file and line) symbol_name: Symbol name (alternative to file+line+column) project_path: Root path of the project include_definitions: Include definitions in results include_subclasses: Also find references to all subclasses (polymorphic search) fields: Fields to include per reference. Valid: name, type, line, column, description, full_name, file, is_definition. Default: all fields.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | No | ||
| line | No | ||
| column | No | ||
| project_path | No | . | |
| include_definitions | No | ||
| include_subclasses | No | ||
| fields | No | ||
| symbol_name | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |