Skip to main content
Glama
ai-naming-standard

AI Naming Standard MCP Server

Official

suggestFolder

Analyzes file names and content to recommend appropriate folders based on AI-driven naming conventions for microservices architecture.

Instructions

Suggest appropriate folder for a file (v6 includes 07_META)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileNameYesFile name to analyze
fileTypeNoType of file (optional)
contentNoFile content preview (optional)

Implementation Reference

  • The primary handler function that implements the suggestFolder tool logic. It analyzes the provided fileName, fileType, and content to determine the most appropriate standard folder based on naming conventions, extensions, and file type mappings.
    export async function suggestFolder({ 
      fileName, 
      fileType,
      content 
    }) {
      const msg = getMessages();
      const rules = namingRules();
      
      // 파일 유형별 폴더 매핑
      const typeMapping = {
        'documentation': '00_DOCS',
        'readme': '00_DOCS',
        'guide': '00_DOCS',
        'config': '01_CONFIG',
        'env': '01_CONFIG',
        'secret': '01_CONFIG',
        'image': '02_STATIC',
        'font': '02_STATIC',
        'template': '02_STATIC',
        'css': '02_STATIC',
        'code': '03_ACTIVE',
        'component': '03_ACTIVE',
        'service': '03_ACTIVE',
        'api': '03_ACTIVE',
        'test': '04_TEST',
        'spec': '04_TEST',
        'e2e': '04_TEST',
        'build': '05_BUILD',
        'dist': '05_BUILD',
        'bundle': '05_BUILD',
        'log': '06_LOGS',
        'error': '06_LOGS',
        'audit': '06_LOGS'
      };
      
      // 확장자별 폴더 매핑
      const extensionMapping = {
        'md': '00_DOCS',
        'txt': '00_DOCS',
        'yml': '01_CONFIG',
        'yaml': '01_CONFIG',
        'env': '01_CONFIG',
        'png': '02_STATIC',
        'jpg': '02_STATIC',
        'svg': '02_STATIC',
        'js': '03_ACTIVE',
        'jsx': '03_ACTIVE',
        'ts': '03_ACTIVE',
        'tsx': '03_ACTIVE',
        'py': '03_ACTIVE',
        'java': '03_ACTIVE',
        'test.js': '04_TEST',
        'spec.js': '04_TEST',
        'min.js': '05_BUILD',
        'bundle.js': '05_BUILD',
        'log': '06_LOGS'
      };
      
      let suggestedFolder = '03_ACTIVE'; // 기본값
      let reason = 'Default for active code';
      
      // 파일명 분석
      if (fileName) {
        const ext = fileName.split('.').pop().toLowerCase();
        
        // v5 네이밍 패턴 체크
        if (/^[0-9]{3}_[A-Z]{2,6}_/.test(fileName)) {
          suggestedFolder = '03_ACTIVE';
          reason = 'Follows v5 naming convention';
        } else if (extensionMapping[ext]) {
          suggestedFolder = extensionMapping[ext];
          reason = `Based on extension: .${ext}`;
        } else if (fileName.includes('test') || fileName.includes('spec')) {
          suggestedFolder = '04_TEST';
          reason = 'Test file detected';
        } else if (fileName.includes('config') || fileName.includes('settings')) {
          suggestedFolder = '01_CONFIG';
          reason = 'Configuration file detected';
        }
      }
      
      // 파일 타입으로 결정
      if (fileType && typeMapping[fileType.toLowerCase()]) {
        suggestedFolder = typeMapping[fileType.toLowerCase()];
        reason = `Based on file type: ${fileType}`;
      }
      
      const folderInfo = rules.standardFolders[suggestedFolder];
      
      return {
        fileName,
        suggestedFolder,
        reason,
        folderInfo: {
          name: folderInfo.name,
          description: folderInfo.description,
          aiPermission: folderInfo.aiPermission,
          namingRuleRequired: folderInfo.namingRuleRequired
        },
        alternativeFolders: Object.keys(rules.standardFolders).filter(f => f !== suggestedFolder),
        message: msg.v5?.folderSuggested || `Suggested folder: ${suggestedFolder} - ${reason}`
      };
    }
  • src/index.js:305-326 (registration)
    Tool registration in the MCP server's TOOLS list, defining the name, description, and input schema for suggestFolder.
    {
      name: 'suggestFolder',
      description: 'Suggest appropriate folder for a file (v6 includes 07_META)',
      inputSchema: {
        type: 'object',
        properties: {
          fileName: {
            type: 'string',
            description: 'File name to analyze'
          },
          fileType: {
            type: 'string',
            description: 'Type of file (optional)'
          },
          content: {
            type: 'string',
            description: 'File content preview (optional)'
          }
        },
        required: ['fileName']
      }
    },
  • src/index.js:633-634 (registration)
    Dispatch handler in the MCP server's CallToolRequestSchema that routes calls to the suggestFolder function.
    case 'suggestFolder':
      result = await suggestFolder(args);
  • Input schema definition for the suggestFolder tool, specifying parameters and requirements.
    inputSchema: {
      type: 'object',
      properties: {
        fileName: {
          type: 'string',
          description: 'File name to analyze'
        },
        fileType: {
          type: 'string',
          description: 'Type of file (optional)'
        },
        content: {
          type: 'string',
          description: 'File content preview (optional)'
        }
      },
      required: ['fileName']
    }

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/ai-naming-standard/mcp'

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