Skip to main content
Glama

Get Symbol

localnest_get_symbol
Read-onlyIdempotent

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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYes
metaNo

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(
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Adds 'fast regex search' which hints at performance characteristics, supplementing the annotations (readOnlyHint, idempotentHint). However, it omits what happens when symbols aren't found, the scope of 'definitions/exports' (e.g., class vs function), or pagination behavior despite max_results parameter.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Extremely concise single sentence where every word carries weight. Front-loaded with action verb and clearly identifies the operation's scope and mechanism without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Inadequate for a 7-parameter tool with 0% schema coverage and numerous similar siblings. While an output schema exists (reducing need for return value description), the description should explain key filtering parameters (all_roots, glob) and distinguish its use case from related search tools.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description fails to compensate for undocumented parameters. It only implicitly references the 'symbol' parameter ('by name'), leaving project_path, all_roots, glob, and case_sensitive unexplained despite their behavioral impact.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States specific action ('Look up'), resource ('symbol definitions/exports'), and method ('fast regex search'). However, it fails to differentiate from siblings like 'localnest_find_usages' or 'localnest_search_code' which also interact with code symbols.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides no guidance on when to use this tool versus alternatives like localnest_search_code, localnest_find_usages, or localnest_search_hybrid. No mention of prerequisites or when-not-to-use conditions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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