Skip to main content
Glama

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
NameRequiredDescriptionDefault
folderPathYesPath to the folder to generate map for

Implementation Reference

  • MCP tool handler for 'generate_folder_map' that extracts folderPath argument and delegates to FolderMapper.generateFolderMap
    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}` }] };
    }
  • 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 list
      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']
      }
    },
  • Input schema definition for the generate_folder_map tool: requires folderPath string
    inputSchema: {
      type: 'object',
      properties: {
        folderPath: { type: 'string', description: 'Path to the folder to generate map for' }
      },
      required: ['folderPath']
    }
  • 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 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;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'Generate or update' but does not clarify what 'update' entails (e.g., overwriting, merging), potential side effects, permissions required, or error handling. This leaves significant gaps in understanding the tool's behavior beyond the basic action stated.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and clear, making it easy to grasp quickly, which aligns well with best practices for conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete for a tool that performs file generation or updates. It does not explain what the '_map.md' file contains, how it is structured, or what the tool returns upon success or failure. This leaves the agent with insufficient context to use the tool effectively in complex scenarios.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% coverage, with 'folderPath' fully described in the schema. The description does not add any additional meaning or context about the parameter beyond what the schema provides, such as format examples or constraints. With high schema coverage, a baseline score of 3 is appropriate as the description does not compensate but also does not detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Generate or update') and the resource ('a _map.md file for a specific folder'), making the purpose understandable. However, it does not explicitly differentiate this tool from its sibling 'generate_all_folder_maps', which might handle multiple folders, leaving some ambiguity in sibling distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'generate_all_folder_maps' or other file-related tools. It lacks context on prerequisites, such as whether the folder must exist or have specific content, and does not mention any exclusions or typical use cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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