Home / Function/ languageFromExtension() — mcp Function Reference

languageFromExtension() — mcp Function Reference

Architecture documentation for the languageFromExtension() function in symbol-context.ts from the mcp codebase.

Entity Profile

Dependency Diagram

graph TD
  67223ccb_3c2b_174e_f218_e621b3b9d580["languageFromExtension()"]
  ca77ccf4_30df_6b5c_22dc_f7ba42fd0765["symbol-context.ts"]
  67223ccb_3c2b_174e_f218_e621b3b9d580 -->|defined in| ca77ccf4_30df_6b5c_22dc_f7ba42fd0765
  fd98a844_5daf_fa4c_d573_003b6d89b6be["renderSymbolContext()"]
  fd98a844_5daf_fa4c_d573_003b6d89b6be -->|calls| 67223ccb_3c2b_174e_f218_e621b3b9d580
  style 67223ccb_3c2b_174e_f218_e621b3b9d580 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/tools/symbol-context.ts lines 381–422

export function languageFromExtension(filePath: string): string {
  const ext = path.extname(filePath).toLowerCase();
  const map: Record<string, string> = {
    '.ts': 'typescript',
    '.tsx': 'typescript',
    '.js': 'javascript',
    '.jsx': 'javascript',
    '.py': 'python',
    '.rb': 'ruby',
    '.go': 'go',
    '.rs': 'rust',
    '.java': 'java',
    '.kt': 'kotlin',
    '.cs': 'csharp',
    '.cpp': 'cpp',
    '.c': 'c',
    '.h': 'c',
    '.hpp': 'cpp',
    '.swift': 'swift',
    '.php': 'php',
    '.scala': 'scala',
    '.sh': 'bash',
    '.bash': 'bash',
    '.yaml': 'yaml',
    '.yml': 'yaml',
    '.json': 'json',
    '.xml': 'xml',
    '.html': 'html',
    '.css': 'css',
    '.sql': 'sql',
    '.r': 'r',
    '.lua': 'lua',
    '.dart': 'dart',
    '.ex': 'elixir',
    '.exs': 'elixir',
    '.erl': 'erlang',
    '.hs': 'haskell',
    '.ml': 'ocaml',
    '.clj': 'clojure',
  };
  return map[ext] || '';
}

Domain

Subdomains

Frequently Asked Questions

What does languageFromExtension() do?
languageFromExtension() is a function in the mcp codebase, defined in src/tools/symbol-context.ts.
Where is languageFromExtension() defined?
languageFromExtension() is defined in src/tools/symbol-context.ts at line 381.
What calls languageFromExtension()?
languageFromExtension() is called by 1 function(s): renderSymbolContext.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free