find_document_symbols
Lists all symbols defined in a Svelte file to enable quick navigation and analysis of components, functions, and variables.
Instructions
List all symbols defined in a file.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Absolute path to the file |
Implementation Reference
- src/tools/navigation.ts:213-231 (handler)The handler function that retrieves document symbols using the LSP client.
async ({ filePath }): Promise<ToolResult> => { try { const prep = await prepareDocumentRequest(lsp, filePath); if ("error" in prep) return textResult(prep.error); const result = await lsp.request("textDocument/documentSymbol", { textDocument: { uri: prep.uri }, }); if (!Array.isArray(result) || result.length === 0) { return textResult("No symbols found."); } return textResult(formatSymbolTree(result)); } catch (ex) { return textResult(formatError(ex)); } } ); - src/tools/navigation.ts:204-212 (registration)Registration of the 'find_document_symbols' tool within the navigation tools module.
server.registerTool( "find_document_symbols", { title: "Find Document Symbols", description: "List all symbols defined in a file.", inputSchema: z.object({ filePath: z.string().describe("Absolute path to the file"), }), },