Skip to main content
Glama

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
NameRequiredDescriptionDefault
symbolYes
project_pathNo
all_rootsNo
globNo*
max_resultsNo
case_sensitiveNo
response_formatNojson

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
      };
    }
  • 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(

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/wmt-mobile/localnest'

If you have feedback or need assistance with the MCP directory API, please join our Discord server