find_references
Locate all instances of a Svelte symbol across your project workspace to track usage and support refactoring tasks.
Instructions
Find all references to a symbol across the workspace.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Absolute path to the file | |
| symbolName | Yes | Name of the symbol to find | |
| symbolKind | No | Kind of symbol | |
| includeDeclaration | No | Include the declaration itself |
Implementation Reference
- src/tools/navigation.ts:51-86 (handler)The "find_references" tool registration and handler implementation.
server.registerTool( "find_references", { title: "Find References", description: "Find all references to a symbol across the workspace.", inputSchema: z.object({ filePath: z.string().describe("Absolute path to the file"), symbolName: z.string().describe("Name of the symbol to find"), symbolKind: z.string().optional().describe("Kind of symbol"), includeDeclaration: z .boolean() .default(true) .describe("Include the declaration itself"), }), }, async ({ filePath, symbolName, symbolKind, includeDeclaration, }): Promise<ToolResult> => { try { const prep = await prepareSymbolRequest(lsp, filePath, symbolName, symbolKind); if ("error" in prep) return textResult(prep.error); const params = { ...makePositionParams(prep.ctx), context: { includeDeclaration }, }; const result = await lsp.request("textDocument/references", params); return textResult(formatLocations(result, "reference")); } catch (ex) { return textResult(formatError(ex)); } } );