Skip to main content
Glama
transparentlyok

MCP Context Manager

get_dependencies

Analyze code dependencies by identifying imports and requires for files or specific symbols to understand what external code is needed.

Instructions

Find all dependencies (imports/requires) for a file or symbol. Useful for understanding what code needs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesFile path to analyze dependencies for
symbolNoOptional: specific symbol to trace dependencies for

Implementation Reference

  • The implementation of getDependencies, which retrieves imports and (if a symbol is specified) analyzes symbol usage within the file.
    async getDependencies(filePath: string, symbol?: string): Promise<any> {
      const fileIndex = this.indexer.getFileIndex(filePath);
    
      if (!fileIndex) {
        return {
          error: `File "${filePath}" not found in index.`,
        };
      }
    
      const result: any = {
        file: filePath,
        imports: fileIndex.imports,
        importCount: fileIndex.imports.length,
      };
    
      if (symbol) {
        // Find the symbol and analyze its dependencies
        const symbolObj = fileIndex.symbols.find((s) => s.name === symbol);
        if (symbolObj) {
          result.symbol = symbol;
          result.symbolType = symbolObj.type;
          result.usedSymbols = this.extractUsedSymbols(symbolObj.code, fileIndex.imports);
        } else {
          result.error = `Symbol "${symbol}" not found in ${filePath}`;
        }
      }
    
      return result;
  • src/index.ts:292-303 (registration)
    Registration of the 'get_dependencies' MCP tool.
    {
      name: 'get_dependencies',
      description: 'Find all dependencies (imports/requires) for a file or symbol. Useful for understanding what code needs.',
      inputSchema: {
        type: 'object',
        properties: {
          filePath: {
            type: 'string',
            description: 'File path to analyze dependencies for',
          },
          symbol: {
            type: 'string',

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