Skip to main content
Glama
transparentlyok

MCP Context Manager

find_symbol

Locate specific functions, classes, or variables in code with fuzzy matching that corrects typos and returns exact file paths and line numbers.

Instructions

⭐ PREFERRED FOR SYMBOLS: Use this INSTEAD OF Grep when looking for specific functions, classes, or variables. Fuzzy matching automatically handles typos ("athenticate" → "authenticate"). Returns exact file path and line number. Much faster than Grep with better accuracy.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYesThe symbol name to find (e.g., function name, class name, variable name)
typeNoThe type of symbol to find. Use "any" to search all types.

Implementation Reference

  • Tool handler logic for `find_symbol` within the `CallToolRequestSchema` switch statement.
    case 'find_symbol': {
      const a = args as any;
      const symbol: string = a.symbol || a.name || a.symbolName;
      const type: string | undefined = a.type;
      if (!symbol) {
        return {
          content: [{ type: 'text', text: 'Error: symbol is required. Provide the symbol name to find.' }],
          isError: true,
        };
      }
      const results = await retriever.findSymbol(symbol, type);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(results, null, 2),
          },
        ],
      };
    }
  • `retriever.findSymbol` method which orchestrates the symbol lookup and includes fuzzy matching logic if direct lookup fails.
    async findSymbol(symbolName: string, type?: string): Promise<any> {
      const symbols = this.indexer.findSymbols(symbolName, type);
    
      if (symbols.length === 0) {
        // Try fuzzy search
        const allSymbols = this.getAllSymbols();
        const fuzzyMatches = allSymbols.filter(s => {
          const typeMatch = !type || type === 'any' || s.type === type;
          return typeMatch && CodeSearchEngine.isFuzzyMatch(symbolName, s.name, 0.65);
        });
    
        if (fuzzyMatches.length > 0) {
          return {
            found: false,
  • `indexer.findSymbols` method that performs the actual symbol retrieval from the `symbolMap`.
    findSymbols(name: string, type?: string): Symbol[] {
      const symbols = this.symbolMap.get(name) || [];
      if (type && type !== 'any') {
        return symbols.filter((s) => s.type === type);
      }
      return symbols;
    }

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/transparentlyok/mcp-context-manager'

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