Skip to main content
Glama

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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, }; } });
  • 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, }; } });

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/0xjcf/MCP_CodeAnalysis'

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