Skip to main content
Glama
giri-jeedigunta

Test Analyzer MCP Server

analyze_test_setup

Analyze repository test setups to detect testing frameworks, identify test files, and examine configurations for JavaScript/TypeScript projects.

Instructions

Analyze the unit test setup of a repository, including framework detection, test file discovery, and configuration analysis

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repoPathYesPath to the repository to analyze

Implementation Reference

  • The primary handler function for the 'analyze_test_setup' tool. It validates input, detects the test framework, finds test files, analyzes test structure, retrieves coverage config and dependencies, and returns a comprehensive TestAnalysisResult.
    private async analyzeTestSetup(args: any) { if (!args.repoPath || typeof args.repoPath !== 'string') { throw new McpError(ErrorCode.InvalidParams, 'repoPath is required'); } try { const repoPath = path.resolve(args.repoPath); // Check if path exists try { await fs.access(repoPath); } catch { throw new McpError(ErrorCode.InvalidParams, `Repository path does not exist: ${repoPath}`); } // Detect test framework const framework = await this.detectTestFramework(repoPath); // Find test files const testFiles = await this.findTestFiles(repoPath, framework); // Analyze test structure const testStructure = await this.analyzeTestStructure(testFiles); // Get coverage configuration const coverageConfig = await this.getCoverageConfig(repoPath, framework); // Get test dependencies const dependencies = await this.getTestDependencies(repoPath); const result: TestAnalysisResult = { framework: framework?.name || null, testFiles: testFiles.map(f => path.relative(repoPath, f)), testCount: testStructure.tests, coverageConfig, testStructure, dependencies, summary: this.generateTestSetupSummary({ framework: framework?.name || null, testFiles, testStructure, coverageConfig, dependencies, }), }; return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { if (error instanceof McpError) throw error; return { content: [ { type: 'text', text: `Error analyzing test setup: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } }
  • src/index.ts:105-118 (registration)
    Tool registration entry in the ListToolsRequestHandler response, defining the tool name, description, and input schema.
    { name: 'analyze_test_setup', description: 'Analyze the unit test setup of a repository, including framework detection, test file discovery, and configuration analysis', inputSchema: { type: 'object', properties: { repoPath: { type: 'string', description: 'Path to the repository to analyze', }, }, required: ['repoPath'], }, },
  • src/index.ts:157-158 (registration)
    Dispatch case in the CallToolRequestHandler switch statement that routes calls to the analyzeTestSetup handler.
    case 'analyze_test_setup': return await this.analyzeTestSetup(request.params.arguments);
  • TypeScript interface defining the structure of the output returned by the analyze_test_setup tool.
    interface TestAnalysisResult { framework: string | null; testFiles: string[]; testCount: number; coverageConfig: any; testStructure: { suites: number; tests: number; hooks: string[]; }; dependencies: string[]; summary: string;

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/giri-jeedigunta/hello-mcp'

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