project-info
Retrieve detailed metadata and insights about software projects to enhance code analysis, optimize dependencies, and support AI-assisted development workflows.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/features/dev-tools/index.ts:107-195 (handler)Inline handler for the project-info tool. Collects project metadata including package info, git status, file counts, and returns a JSON response.server.tool("project-info", {}, async () => { try { const packageJsonPath = join(process.cwd(), "package.json"); let packageInfo = {}; if (existsSync(packageJsonPath)) { const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8")); packageInfo = { name: packageJson.name, version: packageJson.version, description: packageJson.description, dependencies: Object.keys(packageJson.dependencies || {}), devDependencies: Object.keys(packageJson.devDependencies || {}), }; } // Get git info let gitInfo = {}; try { const branch = execSync("git branch --show-current", { encoding: "utf-8", }).trim(); const lastCommit = execSync( 'git log -1 --pretty=format:"%h - %s (%cr)"', { encoding: "utf-8" } ).trim(); gitInfo = { branch, lastCommit }; } catch (e) { gitInfo = { error: "Git information not available" }; } // Count files by type let fileStats = {}; try { const tsFiles = execSync('find src -name "*.ts" | wc -l', { encoding: "utf-8", }).trim(); const jsFiles = execSync('find src -name "*.js" | wc -l', { encoding: "utf-8", }).trim(); const testFiles = execSync('find src -name "*.test.ts" | wc -l', { encoding: "utf-8", }).trim(); fileStats = { tsFiles: parseInt(tsFiles, 10), jsFiles: parseInt(jsFiles, 10), testFiles: parseInt(testFiles, 10), }; } catch (e) { fileStats = { error: "File statistics not available" }; } const result = createSuccessResponse( { packageInfo, gitInfo, fileStats, timestamp: new Date().toISOString(), }, "project-info" ); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: JSON.stringify( createErrorResponse( error instanceof Error ? error.message : String(error), "project-info" ), null, 2 ), }, ], isError: true, }; } });
- src/features/dev-tools/index.ts:107-195 (registration)Registration of the project-info tool using server.tool(), with empty input schema and inline handler implementation.server.tool("project-info", {}, async () => { try { const packageJsonPath = join(process.cwd(), "package.json"); let packageInfo = {}; if (existsSync(packageJsonPath)) { const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8")); packageInfo = { name: packageJson.name, version: packageJson.version, description: packageJson.description, dependencies: Object.keys(packageJson.dependencies || {}), devDependencies: Object.keys(packageJson.devDependencies || {}), }; } // Get git info let gitInfo = {}; try { const branch = execSync("git branch --show-current", { encoding: "utf-8", }).trim(); const lastCommit = execSync( 'git log -1 --pretty=format:"%h - %s (%cr)"', { encoding: "utf-8" } ).trim(); gitInfo = { branch, lastCommit }; } catch (e) { gitInfo = { error: "Git information not available" }; } // Count files by type let fileStats = {}; try { const tsFiles = execSync('find src -name "*.ts" | wc -l', { encoding: "utf-8", }).trim(); const jsFiles = execSync('find src -name "*.js" | wc -l', { encoding: "utf-8", }).trim(); const testFiles = execSync('find src -name "*.test.ts" | wc -l', { encoding: "utf-8", }).trim(); fileStats = { tsFiles: parseInt(tsFiles, 10), jsFiles: parseInt(jsFiles, 10), testFiles: parseInt(testFiles, 10), }; } catch (e) { fileStats = { error: "File statistics not available" }; } const result = createSuccessResponse( { packageInfo, gitInfo, fileStats, timestamp: new Date().toISOString(), }, "project-info" ); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: JSON.stringify( createErrorResponse( error instanceof Error ? error.message : String(error), "project-info" ), null, 2 ), }, ], isError: true, }; } });