generate_folder_map
Create or update a structured map file for any folder to document its contents and organization.
Instructions
Generate or update a _map.md file for a specific folder
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| folderPath | Yes | Path to the folder to generate map for |
Implementation Reference
- src/index.ts:902-906 (handler)MCP tool handler for 'generate_folder_map' that extracts folderPath argument and delegates to FolderMapper.generateFolderMapcase '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}` }] }; }
- src/index.ts:726-735 (registration)Registration of the 'generate_folder_map' tool including name, description, and input schema in the MCP server's tools listname: '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'] } },
- src/index.ts:728-734 (schema)Input schema definition for the generate_folder_map tool: requires folderPath stringinputSchema: { type: 'object', properties: { folderPath: { type: 'string', description: 'Path to the folder to generate map for' } }, required: ['folderPath'] }
- src/folder-mapper.ts:116-149 (helper)Main implementation logic for generating folder maps: scans files in folder, analyzes exports/imports using TypeScript parser, builds FolderMap object, generates and writes _map.md fileasync 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; }