evaluate_readme
Assess and improve README file structure in repositories by analyzing content quality, identifying gaps, and providing actionable suggestions for documentation enhancement.
Instructions
リポジトリ内の全てのREADMEファイルの構成を評価し、改善点を提案します
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectPath | Yes | プロジェクトのルートディレクトリパス |
Implementation Reference
- src/index.ts:40-57 (registration)Registers the 'evaluate_readme' tool by handling ListToolsRequestSchema and providing name, description, and input schema.this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ { name: 'evaluate_readme', description: 'リポジトリ内の全てのREADMEファイルの構成を評価し、改善点を提案します', inputSchema: { type: 'object', properties: { projectPath: { type: 'string', description: 'プロジェクトのルートディレクトリパス', }, }, required: ['projectPath'], }, }, ], }));
- src/index.ts:45-54 (schema)Input schema definition for the evaluate_readme tool requiring a projectPath string.inputSchema: { type: 'object', properties: { projectPath: { type: 'string', description: 'プロジェクトのルートディレクトリパス', }, }, required: ['projectPath'], },
- src/index.ts:59-91 (handler)Main handler for the 'evaluate_readme' tool call. Checks tool name, extracts projectPath, calls ReadmeService.evaluateAllReadmes, and formats response.this.server.setRequestHandler(CallToolRequestSchema, async (request) => { if (request.params.name !== 'evaluate_readme') { throw new McpError( ErrorCode.MethodNotFound, `Unknown tool: ${request.params.name}` ); } const { projectPath } = request.params.arguments as { projectPath: string }; try { const evaluations = await this.readmeService.evaluateAllReadmes(projectPath); return { content: [ { type: 'text', text: JSON.stringify(evaluations, null, 2), }, ], }; } catch (error: unknown) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [ { type: 'text', text: `評価中にエラーが発生しました: ${errorMessage}`, }, ], isError: true, }; } });
- src/services/readme.service.ts:16-27 (helper)Helper method that finds all README files in the project and evaluates each using evaluateReadme.public async evaluateAllReadmes(projectPath: string): Promise<ReadmeEvaluation[]> { const readmeFiles = await findReadmeFiles(projectPath); const evaluations: ReadmeEvaluation[] = []; for (const readmePath of readmeFiles) { const dirPath = path.dirname(readmePath); const evaluation = await this.evaluateReadme(dirPath, readmePath); evaluations.push(evaluation); } return evaluations; }
- src/services/readme.service.ts:29-74 (handler)Core evaluation logic for a single README file: parses content, evaluates badges, header image, title, calculates score, generates suggestions.private async evaluateReadme(dirPath: string, readmePath: string): Promise<ReadmeEvaluation> { const content = fs.readFileSync(readmePath, 'utf-8'); const badgeEvaluation = this.evaluateLanguageBadges(content); const evaluation: ReadmeEvaluation = { filePath: readmePath, hasHeaderImage: false, headerImageQuality: { hasGradient: false, hasAnimation: false, hasRoundedCorners: false, hasEnglishText: false, isProjectSpecific: false, }, isCentered: { headerImage: false, title: false, badges: badgeEvaluation.isCentered, }, hasBadges: { english: badgeEvaluation.hasEnglishBadge, japanese: badgeEvaluation.hasJapaneseBadge, isCentered: badgeEvaluation.isCentered, hasCorrectFormat: badgeEvaluation.hasCorrectFormat, }, hasReadme: { english: fs.existsSync(path.join(dirPath, 'README.md')), japanese: fs.existsSync(path.join(dirPath, 'README.ja.md')), }, score: 0, suggestions: [], }; // marked.parseは非同期なので、awaitを使用 const html = await Promise.resolve(marked.parse(content)); const $ = cheerio.load(html); // その他の評価ロジック... this.evaluateHeaderImage($, evaluation, content); this.evaluateTitle($, evaluation); this.calculateScore(evaluation); this.generateSuggestions(evaluation, dirPath, readmePath); return evaluation; }