Skip to main content
Glama

analyze_project_structure

Analyze project structure to identify technology stacks and architecture patterns for development planning and optimization.

Instructions

分析项目结构,识别技术栈和架构

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNo项目根目录路径(默认当前目录)

Implementation Reference

  • Main execution logic for the analyze_project_structure tool. Analyzes project directory by detecting package.json dependencies, config files for various tech stacks (Node.js, React, etc.), lists top-level directories, and generates a markdown report with suggestions.
    case 'analyze_project_structure': { const { path: projectPath = '.' } = args as { path?: string }; const fullPath = join(process.cwd(), projectPath); if (!existsSync(fullPath)) { throw new Error(`路径不存在: ${projectPath}`); } // 检测项目特征 const features: string[] = []; const techStack: string[] = []; // 检测 package.json const pkgPath = join(fullPath, 'package.json'); if (existsSync(pkgPath)) { const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8')); features.push('Node.js 项目'); const deps = { ...pkg.dependencies, ...pkg.devDependencies }; if (deps.react) techStack.push('React'); if (deps.vue) techStack.push('Vue'); if (deps.angular) techStack.push('Angular'); if (deps.next) techStack.push('Next.js'); if (deps.express) techStack.push('Express'); if (deps.nestjs || deps['@nestjs/core']) techStack.push('NestJS'); if (deps.typescript) techStack.push('TypeScript'); if (deps.tailwindcss) techStack.push('TailwindCSS'); } // 检测其他配置文件 if (existsSync(join(fullPath, 'tsconfig.json'))) features.push('TypeScript 配置'); if (existsSync(join(fullPath, 'docker-compose.yml')) || existsSync(join(fullPath, 'Dockerfile'))) features.push('Docker 支持'); if (existsSync(join(fullPath, '.github'))) features.push('GitHub Actions'); if (existsSync(join(fullPath, 'pyproject.toml')) || existsSync(join(fullPath, 'requirements.txt'))) features.push('Python 项目'); if (existsSync(join(fullPath, 'Cargo.toml'))) features.push('Rust 项目'); if (existsSync(join(fullPath, 'go.mod'))) features.push('Go 项目'); // 统计目录结构 const dirs = readdirSync(fullPath).filter(f => { const stat = statSync(join(fullPath, f)); return stat.isDirectory() && !f.startsWith('.') && f !== 'node_modules'; }); const analysis = `# 🏗️ 项目结构分析 ## 项目类型 ${features.length > 0 ? features.map(f => `- ${f}`).join('\n') : '- 未识别'} ## 技术栈 ${techStack.length > 0 ? techStack.map(t => `- ${t}`).join('\n') : '- 未检测到常用框架'} ## 目录结构 ${dirs.map(d => `- 📁 ${d}/`).join('\n') || '- (空目录)'} ## 建议 ${techStack.includes('React') ? '- 前端任务可分配给 **frontend** 专家' : ''} ${techStack.includes('Express') || techStack.includes('NestJS') ? '- 后端任务可分配给 **backend** 专家' : ''} ${features.includes('TypeScript 配置') ? '- 项目使用 TypeScript,专家应输出类型安全的代码' : ''} ${features.includes('Docker 支持') ? '- 部署相关任务可考虑添加 **devops** 自定义专家' : ''}`; return { content: [{ type: 'text', text: analysis }], }; }
  • src/server.ts:344-356 (registration)
    Tool registration including name, description, and input schema (optional path parameter).
    { name: 'analyze_project_structure', description: '分析项目结构,识别技术栈和架构', inputSchema: { type: 'object', properties: { path: { type: 'string', description: '项目根目录路径(默认当前目录)', }, }, }, },
  • Input schema definition for the tool, specifying an optional 'path' string parameter.
    inputSchema: { type: 'object', properties: { path: { type: 'string', description: '项目根目录路径(默认当前目录)', }, }, },

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/7836246/claude-team-mcp'

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