# find-definition > Symbol kind (class, method, function, variable) - helps narrow results - Author: joel_aniol-admin - Repository: JoelCampoint/claude_lsp - Version: 20260125221258 - Stars: 0 - Forks: 0 - Last Updated: 2026-02-06 - Source: https://github.com/JoelCampoint/claude_lsp - Web: https://mule.run/skillshub/@@JoelCampoint/claude_lsp~find-definition:20260125221258 --- --- name: find-definition description: USE THIS PROACTIVELY whenever you need to find or understand code - don't wait for the user to ask! Use it when looking for a class, function, or method definition. Much faster than Grep/Glob. Example - user says "modify UserService" → use find_definition("UserService") first. arguments: - name: symbol description: The symbol name to find (e.g., "MyClass", "myFunction") required: true - name: file description: File where the symbol is DEFINED (not where it's used/imported) required: false - name: kind description: Symbol kind (class, method, function, variable) - helps narrow results required: false --- # Find Definition Use the LSP `find_definition` tool to locate where a symbol is defined. ## Important Limitation ⚠️ **The file_path must be the file where the symbol is DEFINED, not where it's imported/used.** | Scenario | Works? | |----------|--------| | Find `show` method in `ImageController.php` (defined there) | ✅ Yes | | Find `View` class in `ImageController.php` (only imported) | ❌ No | | Find `View` class in `View.php` (defined there) | ✅ Yes | ## Steps 1. Determine where the symbol is **defined**: - For local methods/functions: use the current file - For imported classes: find the source file first (check `use` statements or use Glob) 2. Use `mcp__cclsp__find_definition` with: - `symbol_name`: "{{symbol}}" - `file_path`: the file where the symbol is **defined** {{#if kind}} - `symbol_kind`: "{{kind}}" (optional: class, method, function, variable) {{/if}} 3. Report the definition location with file path and line number. 4. Optionally read a few lines around the definition to show context. ## Example: Finding a Local Method ``` User: "Where is the show method defined?" → Use find_definition with file where it's defined → Found: ImageController.php:160 ``` ## Example: Finding an Imported Class ``` User: "Where is the View class defined?" Step 1: Check imports in current file use Core\View; → It's in Core namespace Step 2: Find the file Glob for: **/View.php in core/ directory → Found: core/View.php Step 3: Now use find_definition file_path: core/View.php symbol_name: View → Found definition at line 8 ``` ## Example Output ``` Found definition of `View`: 📍 core/View.php:8 class View { private static $data = []; ... } ``` ## Parameters | Parameter | Required | Description | |-----------|----------|-------------| | `symbol_name` | ✅ Yes | The symbol to find | | `file_path` | ✅ Yes | File where symbol is **defined** | | `symbol_kind` | Optional | Helps narrow: class, method, function, variable | ## Fallback If LSP fails (unsupported language, server error), fall back to: ``` Grep for: "class {{symbol}}" or "function {{symbol}}" ``` But warn the user that results may be less accurate. ## Pro Tip For imported symbols, combine with `find_references` first - it can show where the symbol is defined AND used, helping you locate the source file.