Skip to main content
Glama

generate_folder_map

Create or update a _map.md file for any folder to document its structure and contents, ensuring organized and accessible project navigation.

Instructions

Generate or update a _map.md file for a specific folder

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
folderPathYesPath to the folder to generate map for

Implementation Reference

  • src/index.ts:725-735 (registration)
    Registration of the 'generate_folder_map' tool in the MCP server's tool list, including name, description, and input schema definition.
    { name: 'generate_folder_map', description: 'Generate or update a _map.md file for a specific folder', inputSchema: { type: 'object', properties: { folderPath: { type: 'string', description: 'Path to the folder to generate map for' } }, required: ['folderPath'] } },
  • MCP CallToolRequest handler case for 'generate_folder_map' that validates arguments, calls FolderMapper.generateFolderMap(folderPath), and returns success message.
    case 'generate_folder_map': { const folderPath = args.folderPath as string; const folderMap = await this.folderMapper.generateFolderMap(folderPath); return { content: [{ type: 'text', text: `Folder map generated successfully for: ${folderPath}` }] }; }
  • Core implementation of generateFolderMap in FolderMapper class: scans folder for code files, analyzes each using TypeScript ESTree parser to extract exports/imports, builds FolderMap structure with stats and inferences, generates and writes _map.md markdown file.
    async generateFolderMap(folderPath: string): Promise<FolderMap> { const folderName = path.basename(folderPath); console.log(chalk.blue(`📁 Generating map for: ${folderName}`)); const files = await this.getFilesInFolder(folderPath); const fileInfos: FileInfo[] = []; for (const file of files) { try { const fileInfo = await this.analyzeFile(file); if (fileInfo.exports.length > 0) { fileInfos.push(fileInfo); } } catch (error) { console.log(chalk.yellow(`⚠️ Could not analyze ${file}: ${error}`)); } } const folderMap: FolderMap = { folderPath, folderName, purpose: this.inferFolderPurpose(folderName, fileInfos), files: fileInfos, dependencies: this.extractUniqueDependencies(fileInfos), tests: await this.findRelatedTests(folderPath), lastGenerated: new Date().toISOString(), totalClasses: this.countByType(fileInfos, 'class'), totalInterfaces: this.countByType(fileInfos, 'interface'), totalFunctions: this.countByType(fileInfos, 'function') }; await this.writeMapFile(folderPath, folderMap); return folderMap; }

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/keleshteri/mcp-memory'

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