getProjectInfo
Retrieve project statistics including file count, symbol count, critical point count, and detected languages to understand codebase scale.
Instructions
Get project statistics: file count, symbol count, critical point count, languages detected
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:145-153 (registration)The tool 'getProjectInfo' is registered in the getAvailableTools() array with name, description, and an empty inputSchema (no params required).
{ name: 'getProjectInfo', description: 'Get project statistics: file count, symbol count, critical point count, languages detected', inputSchema: { type: 'object' as const, properties: {}, required: [], }, }, - src/index.ts:611-658 (handler)The handler function handleGetProjectInfo() builds a markdown report with project name, language, root path, symbol count, edge count, critical point count, symbol type distribution, and critical point type distribution using data from codeAnalyzer.
private async handleGetProjectInfo(): Promise<{ content: TextContent[] }> { const config = this.configManager.getConfig(); let result = `# 📊 项目信息\n\n`; result += `**名称:** ${config.project.name}\n`; result += `**语言:** ${config.project.languages.join(', ')}\n`; result += `**根路径:** ${config.project.rootPath}\n\n`; if (this.codeAnalyzer) { const symbols = this.codeAnalyzer.getAllSymbols(); const edges = this.codeAnalyzer.getResolvedEdges(); const cps = this.codeAnalyzer.getCriticalPoints(); result += `## 📈 分析统计\n\n`; result += `- **符号总数:** ${symbols.length}\n`; result += `- **调用边:** ${edges.length}\n`; result += `- **关键操作:** ${cps.length}\n\n`; const symbolsByType: Record<string, number> = {}; for (const symbol of symbols) { symbolsByType[symbol.type] = (symbolsByType[symbol.type] || 0) + 1; } result += `### 符号类型分布\n`; for (const [type, count] of Object.entries(symbolsByType)) { result += `- ${type}: ${count}\n`; } if (cps.length > 0) { const cpByType: Record<string, number> = {}; for (const cp of cps) { cpByType[cp.type] = (cpByType[cp.type] || 0) + 1; } result += `\n### 关键操作分布\n`; for (const [type, count] of Object.entries(cpByType)) { result += `- ${type}: ${count}\n`; } } } return { content: [ { type: 'text', text: result, }, ], }; } - src/index.ts:179-180 (registration)The tool dispatch in handleToolCall routes the 'getProjectInfo' tool name to handleGetProjectInfo().
case 'getProjectInfo': return this.handleGetProjectInfo();