localnest_get_symbol
Find symbol definitions and exports by name using fast regex search across your local codebase. This tool helps developers locate code elements quickly for analysis or refactoring.
Instructions
Look up symbol definitions/exports by name using fast regex search.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | ||
| project_path | No | ||
| all_roots | No | ||
| glob | No | * | |
| max_results | No | ||
| case_sensitive | No | ||
| response_format | No | json |
Implementation Reference
- The getSymbol function implements the actual logic for looking up symbol definitions, including regex pattern matching via searchCode and classification of search results.
getSymbol({ symbol, projectPath, allRoots, glob = '*', maxResults = 100, caseSensitive = false }) { const normalized = normalizeSymbolInput(symbol); if (!normalized) throw new Error('symbol is required'); const rows = this.searchCode({ query: buildDefinitionPattern(normalized), projectPath, allRoots, glob, maxResults, caseSensitive, useRegex: true, contextLines: 0 }); const definitions = []; const exports = []; for (const row of rows) { const classification = classifySymbolLine(row.text, normalized); const item = { file: row.file, start_line: row.line, end_line: row.line, text: row.text }; if (classification === 'definition') definitions.push(item); if (/\bexport\b|module\.exports|exports\./i.test(row.text)) exports.push(item); } return { symbol: normalized, count: rows.length, definitions, exports }; } - src/mcp/tools/retrieval.js:360-380 (registration)The 'localnest_get_symbol' tool is registered here with its input schema and calls the service layer's getSymbol method.
registerJsonTool( 'localnest_get_symbol', { title: 'Get Symbol', description: 'Look up symbol definitions/exports by name using fast regex search.', inputSchema: { symbol: z.string().min(1), project_path: z.string().optional(), all_roots: z.boolean().default(false), glob: z.string().default('*'), max_results: z.number().int().min(1).max(1000).default(defaultMaxResults), case_sensitive: z.boolean().default(false) }, annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false } }, async ({ symbol, project_path, all_roots, glob, max_results, case_sensitive }) => normalizeSymbolResult(