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;
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It describes what the tool does ('analyze', 'detection', 'discovery', 'analysis') but doesn't cover key traits like whether it's read-only, if it modifies files, permission requirements, rate limits, or output format. This leaves significant gaps for an agent to understand its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the main purpose ('Analyze the unit test setup of a repository') and adds specifics without waste. Every word earns its place, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (analyzing test setups with multiple aspects) and lack of annotations and output schema, the description is incomplete. It doesn't explain what the analysis returns, potential side effects, or error conditions, leaving the agent with insufficient context for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with 'repoPath' clearly documented. The description adds no additional parameter details beyond what the schema provides, such as format examples or constraints. Since the schema does the heavy lifting, the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('analyze', 'detection', 'discovery', 'analysis') and resources ('unit test setup', 'repository'), making it easy to understand what it does. However, it doesn't explicitly differentiate from sibling tools like 'check_coverage' or 'get_test_summary', which might have overlapping scopes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus its siblings ('check_coverage', 'get_test_summary'), such as whether it's for initial setup analysis versus ongoing monitoring. It implies usage through context but lacks explicit when/when-not or alternative recommendations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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