Skip to main content
Glama
haasonsaas

Deep Code Reasoning MCP Server

by haasonsaas

cross_system_impact

Analyze the impact of code changes across distributed systems using Gemini AI. Identify breaking, performance, and behavioral effects by specifying files and services for comprehensive cross-boundary debugging.

Instructions

Use Gemini to analyze changes across service boundaries

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
change_scopeYes
impact_typesNo

Implementation Reference

  • Core handler function that performs the cross-system impact analysis: reads changed files and related service files (Services, Controllers, Clients), gathers code content, and delegates to Gemini service for analysis.
    async analyzeCrossSystemImpact(
      changeScope: string[],
      impactTypes?: string[],
    ): Promise<{
      analysis: string;
      filesAnalyzed: string[];
      impactTypes: string[];
    }> {
      const codeFiles = new Map<string, string>();
    
      // Read all files in change scope
      for (const file of changeScope) {
        try {
          const content = await this.codeReader.readFile(file);
          codeFiles.set(file, content);
    
          // Also read related service files
          const relatedFiles = await this.codeReader.findRelatedFiles(file, ['Service', 'Controller', 'Client']);
          for (const related of relatedFiles) {
            const relatedContent = await this.codeReader.readFile(related);
            codeFiles.set(related, relatedContent);
          }
        } catch (error) {
          console.error(`Failed to read ${file}:`, error);
        }
      }
    
      // Use Gemini for cross-system analysis
      const analysis = await this.geminiService.performCrossSystemAnalysis(
        codeFiles,
        changeScope,
      );
    
      return {
        analysis,
        filesAnalyzed: Array.from(codeFiles.keys()),
        impactTypes: impactTypes || ['breaking', 'performance', 'behavioral'],
      };
    }
  • Zod schema defining input validation for the cross_system_impact tool, matching the MCP inputSchema.
    const CrossSystemImpactSchema = z.object({
      change_scope: z.object({
        files: z.array(z.string()),
        service_names: z.array(z.string()).optional(),
      }),
      impact_types: z.array(z.enum(['breaking', 'performance', 'behavioral'])).optional(),
    });
  • src/index.ts:256-276 (registration)
    MCP tool registration in ListTools handler, defining name, description, and inputSchema for cross_system_impact.
      name: 'cross_system_impact',
      description: 'Use Gemini to analyze changes across service boundaries',
      inputSchema: {
        type: 'object',
        properties: {
          change_scope: {
            type: 'object',
            properties: {
              files: { type: 'array', items: { type: 'string' } },
              service_names: { type: 'array', items: { type: 'string' } },
            },
            required: ['files'],
          },
          impact_types: {
            type: 'array',
            items: { type: 'string', enum: ['breaking', 'performance', 'behavioral'] },
          },
        },
        required: ['change_scope'],
      },
    },
  • MCP CallTool request handler case that parses input, validates files, calls the deepReasoner handler, and formats response.
    case 'cross_system_impact': {
      const parsed = CrossSystemImpactSchema.parse(args);
    
      // Validate file paths
      const validatedFiles = InputValidator.validateFilePaths(parsed.change_scope.files);
      if (validatedFiles.length === 0) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'No valid file paths provided',
        );
      }
    
      const result = await deepReasoner.analyzeCrossSystemImpact(
        validatedFiles,
        parsed.impact_types,
      );
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
Install Server

Other Tools

Related 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/haasonsaas/deep-code-reasoning-mcp'

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