Skip to main content
Glama

analyze_dependencies

Analyze project dependencies to identify unused packages, outdated versions, and security vulnerabilities for improved code quality and maintenance.

Instructions

Analyze project dependencies including unused, outdated, and vulnerable packages

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathNoPath to project root (defaults to current directory)
checkUnusedNoCheck for unused dependencies
checkOutdatedNoCheck for outdated packages
checkVulnerabilitiesNoCheck for security vulnerabilities
checkBundleSizeNoCheck bundle size

Implementation Reference

  • Core handler function implementing the logic to analyze project dependencies by parsing package.json and performing optional checks for unused deps, outdated packages, and vulnerabilities.
    async analyzeDependencies( projectPath: string = process.cwd(), options?: DependencyAnalysisOptions ): Promise<DependencyReport> { const packageJsonPath = join(projectPath, 'package.json'); if (!existsSync(packageJsonPath)) { throw new Error('package.json not found'); } const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8')); const dependencies = this.extractDependencies(packageJson); const report: DependencyReport = { dependencies, unused: options?.checkUnused !== false ? await this.findUnusedDependencies(projectPath) : [], outdated: options?.checkOutdated !== false ? await this.findOutdatedPackages(packageJson) : [], vulnerabilities: options?.checkVulnerabilities !== false ? await this.findVulnerabilities(projectPath) : [], totalDependencies: dependencies.length, }; return report; }
  • Tool-specific handler case within handleDependencyAnalysisTool that parses input arguments and invokes the core analyzer.
    case 'analyze_dependencies': { const options: DependencyAnalysisOptions = { checkUnused: params.checkUnused as boolean, checkOutdated: params.checkOutdated as boolean, checkVulnerabilities: params.checkVulnerabilities as boolean, checkBundleSize: params.checkBundleSize as boolean, }; const report = await analyzer.analyzeDependencies(projectPath, options); return Formatters.formatDependencyReport(report); }
  • JSON Schema defining the input parameters for the analyze_dependencies tool.
    inputSchema: { type: 'object', properties: { projectPath: { type: 'string', description: 'Path to project root (defaults to current directory)', }, checkUnused: { type: 'boolean', description: 'Check for unused dependencies', default: true, }, checkOutdated: { type: 'boolean', description: 'Check for outdated packages', default: true, }, checkVulnerabilities: { type: 'boolean', description: 'Check for security vulnerabilities', default: true, }, checkBundleSize: { type: 'boolean', description: 'Check bundle size', default: false, }, }, },
  • Tool registration object defining name, description, and schema, exported as part of dependencyAnalysisTools array.
    { name: 'analyze_dependencies', description: 'Analyze project dependencies including unused, outdated, and vulnerable packages', inputSchema: { type: 'object', properties: { projectPath: { type: 'string', description: 'Path to project root (defaults to current directory)', }, checkUnused: { type: 'boolean', description: 'Check for unused dependencies', default: true, }, checkOutdated: { type: 'boolean', description: 'Check for outdated packages', default: true, }, checkVulnerabilities: { type: 'boolean', description: 'Check for security vulnerabilities', default: true, }, checkBundleSize: { type: 'boolean', description: 'Check bundle size', default: false, }, }, }, },
  • src/server.ts:66-67 (registration)
    Main server dispatch registration routing calls to analyze_dependencies to the appropriate handler.
    } else if (dependencyAnalysisTools.some((t) => t.name === name)) { result = await handleDependencyAnalysisTool(name, args || {});

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/code-alchemist01/development-tools-mcp-Server'

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