find_symbol_definition
Locates the file path and line number where a symbol (function, class, variable) is defined, using SourceGraph's indexed symbol search.
Instructions
Find where a symbol (function, class, method, variable, constant) is DEFINED in the codebase. Returns the exact file path and line number where the symbol is declared.
This uses SourceGraph's indexed symbol search for fast lookups. Perfect for 'go to definition' or 'where is X defined?' queries.
Returns: File path, line number, and column position of the definition.
Examples:
Find where the ProcessOrder function is defined
Locate the definition of class CustomerService
Find where variable API_KEY is declared
Show me where the HandleRequest method is defined
Tips:
Use symbol_kind filter to narrow results (function, class, method, variable)
Use repo_filter to search specific repositories (e.g., 'repo:myorg/myrepo')
Searches are case-sensitive by default
Note: To find where a symbol is USED (not defined), use find_symbol_references instead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol_name | Yes | Name of the symbol to find (e.g., 'ProcessOrder', 'CustomerService', 'API_KEY') | |
| symbol_kind | No | Optional: Filter by symbol kind to narrow results | |
| repo_filter | No | Optional: Filter by repository (e.g., 'repo:owner/name' or 'repo:^github\.com/org/project$') | |
| max_results | No | Maximum number of results (default: 10) |