Skip to main content
Glama
0xjcf
by 0xjcf

evolution-pathway

Analyze code repositories to generate actionable evolution pathways for modernizing architecture, improving performance, enhancing security, or reducing technical debt within specified timeframes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repositoryUrlYes
targetGoalYes
timeframeYes
includeImplementationDetailsNo

Implementation Reference

  • Handler function for the 'evolution-pathway' tool that calls generateEvolutionPlan and formats the response as MCP content.
    async ({ repositoryUrl, targetGoal, timeframe, includeImplementationDetails }) => {
      try {
        const plan = await generateEvolutionPlan(
          repositoryUrl, 
          targetGoal, 
          timeframe,
          includeImplementationDetails
        );
        
        return {
          content: [{
            type: "text",
            text: JSON.stringify(plan, null, 2)
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: "text",
            text: `Error generating evolution pathway: ${(error as Error).message}`
          }],
          isError: true
        };
      }
    }
  • Zod input schema defining parameters for the evolution-pathway tool.
    {
      repositoryUrl: z.string(),
      targetGoal: z.enum([
        "modernize-architecture", 
        "improve-performance", 
        "enhance-security",
        "reduce-technical-debt"
      ]),
      timeframe: z.enum(["immediate", "sprint", "quarter", "year"]),
      includeImplementationDetails: z.boolean().default(true)
    },
  • Registers the 'evolution-pathway' MCP tool with server.tool(), providing schema and handler.
    server.tool(
      "evolution-pathway",
      {
        repositoryUrl: z.string(),
        targetGoal: z.enum([
          "modernize-architecture", 
          "improve-performance", 
          "enhance-security",
          "reduce-technical-debt"
        ]),
        timeframe: z.enum(["immediate", "sprint", "quarter", "year"]),
        includeImplementationDetails: z.boolean().default(true)
      },
      async ({ repositoryUrl, targetGoal, timeframe, includeImplementationDetails }) => {
        try {
          const plan = await generateEvolutionPlan(
            repositoryUrl, 
            targetGoal, 
            timeframe,
            includeImplementationDetails
          );
          
          return {
            content: [{
              type: "text",
              text: JSON.stringify(plan, null, 2)
            }]
          };
        } catch (error) {
          return {
            content: [{
              type: "text",
              text: `Error generating evolution pathway: ${(error as Error).message}`
            }],
            isError: true
          };
        }
      }
    );
  • Main helper function implementing the evolution pathway logic: clones repo, analyzes code, detects frameworks, builds knowledge graph, generates goal-specific plans with recommendations filtered by timeframe.
    export async function generateEvolutionPlan(
      repositoryUrl: string,
      targetGoal:
        | "modernize-architecture"
        | "improve-performance"
        | "enhance-security"
        | "reduce-technical-debt",
      timeframe: "immediate" | "sprint" | "quarter" | "year",
      includeImplementationDetails: boolean = true
    ): Promise<any> {
      console.log(
        `Generating ${targetGoal} evolution plan for ${repositoryUrl} (${timeframe} timeframe)`
      );
    
      // Step 1: Clone/update the repository
      const repoPath = await getRepository(repositoryUrl);
    
      // Step 2: Analyze the codebase
      const files = listFiles(repoPath);
      const fileAnalyses: Record<string, any> = {};
    
      // Analyze a subset of files to avoid performance issues with large repositories
      const filesToAnalyze = selectRepresentativeFiles(files, 50);
    
      console.log(`Analyzing ${filesToAnalyze.length} representative files...`);
      for (const file of filesToAnalyze) {
        try {
          const fullPath = path.join(repoPath, file);
          const code = fs.readFileSync(fullPath, "utf8");
          const fileLanguage = path.extname(file).slice(1);
          const analysis = analyzeCode(code, fileLanguage);
          fileAnalyses[file] = analysis;
        } catch (error) {
          console.warn(`Error analyzing file ${file}: ${(error as Error).message}`);
        }
      }
    
      // Step 3: Build knowledge graph
      console.log(`Building knowledge graph...`);
      const { nodes, relationships } = await buildKnowledgeGraph(
        repositoryUrl,
        2,
        false
      );
    
      // Step 4: Retrieve insights from memory
      console.log(`Retrieving memories about this repository...`);
      const memories = await retrieveMemories({
        repositoryUrl,
        limit: 10,
      });
    
      // Step 5: Generate the evolution plan based on target goal and timeframe
      console.log(`Generating ${targetGoal} plan...`);
    
      // Analyze major frameworks and libraries used
      const frameworks = detectFrameworks(files, fileAnalyses);
    
      // Analyze project structure
      const projectStructure = analyzeProjectStructure(files);
    
      // Generate plan based on target goal
      let plan;
      switch (targetGoal) {
        case "modernize-architecture":
          plan = generateModernizeArchitecturePlan(
            repositoryUrl,
            frameworks,
            projectStructure,
            fileAnalyses,
            timeframe,
            includeImplementationDetails
          );
          break;
        case "improve-performance":
          plan = generatePerformancePlan(
            repositoryUrl,
            frameworks,
            fileAnalyses,
            timeframe,
            includeImplementationDetails
          );
          break;
        case "enhance-security":
          plan = generateSecurityPlan(
            repositoryUrl,
            frameworks,
            fileAnalyses,
            timeframe,
            includeImplementationDetails
          );
          break;
        case "reduce-technical-debt":
          plan = generateTechnicalDebtPlan(
            repositoryUrl,
            frameworks,
            projectStructure,
            fileAnalyses,
            timeframe,
            includeImplementationDetails
          );
          break;
        default:
          throw new Error(`Unknown target goal: ${targetGoal}`);
      }
    
      // Return the evolution plan
      return {
        repository: {
          url: repositoryUrl,
          summary: summarizeRepository(
            files,
            fileAnalyses,
            frameworks,
            projectStructure
          ),
        },
        targetGoal,
        timeframe,
        plan,
      };
    }
Behavior1/5

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

Tool has no description.

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

Conciseness1/5

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

Tool has no description.

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

Completeness1/5

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

Tool has no description.

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

Parameters1/5

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

Tool has no description.

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

Purpose1/5

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

Tool has no description.

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

Usage Guidelines1/5

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

Tool has no description.

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

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