Skip to main content
Glama

analyze_tech_stack

Analyzes GitHub repository technology stacks to generate targeted Learning Hour content for team skill development and technical practice sessions.

Instructions

Analyze a repository's technology stack to create team-specific Learning Hour content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repositoryUrlYesGitHub repository URL to analyze

Implementation Reference

  • Core handler function implementing the tech stack analysis logic by parsing repository config files, extracting languages, detecting frameworks, testing tools, build tools, and architectural patterns.
    async analyzeTechStack(repositoryUrl: string): Promise<TechStackProfile> {
      const { owner, repo } = this.parseGitHubUrl(repositoryUrl);
      
      try {
        const configFiles = await this.getConfigurationFiles(owner, repo);
        const repoInfo = await this.githubClient.getRepositoryInfo(owner, repo);
        
        const primaryLanguages = this.extractLanguages(repoInfo);
        const { frameworks, testingFrameworks, buildTools, dependencies } = 
          await this.analyzeConfigFiles(owner, repo, configFiles);
        const architecturalPatterns = await this.detectArchitecturalPatterns(owner, repo);
    
        // Always return something, even if we couldn't find specific details
        if (primaryLanguages.length === 0) {
          primaryLanguages.push('Unknown');
        }
    
        return {
          primaryLanguages,
          frameworks,
          testingFrameworks,
          buildTools,
          architecturalPatterns,
          packageDependencies: dependencies
        };
      } catch (error) {
        if (error instanceof Error && error.message.includes('GitHub MCP client not connected')) {
          throw new Error('GitHub integration not configured. Please ensure GITHUB_TOKEN is set in your environment.');
        }
        throw error;
      }
    }
  • src/index.ts:171-184 (registration)
    Tool registration in the MCP server's listTools response, defining name, description, and input schema.
    {
      name: "analyze_tech_stack",
      description: "Analyze a repository's technology stack to create team-specific Learning Hour content",
      inputSchema: {
        type: "object",
        properties: {
          repositoryUrl: {
            type: "string",
            description: "GitHub repository URL to analyze",
          },
        },
        required: ["repositoryUrl"],
      },
    },
  • Zod input schema for validating the repositoryUrl argument.
    const AnalyzeTechStackInputSchema = z.object({
      repositoryUrl: z.string().min(1, "Repository URL is required"),
    });
  • MCP server wrapper handler that validates input, calls TechStackAnalyzer, formats response, and handles errors.
    private async analyzeTechStack(args: any) {
      const input = AnalyzeTechStackInputSchema.parse(args);
    
      try {
        const techProfile = await this.techStackAnalyzer.analyzeTechStack(input.repositoryUrl);
    
        return {
          content: [
            {
              type: "text",
              text: `✅ Technology stack analysis completed for: ${input.repositoryUrl}`,
            },
            {
              type: "text",
              text: `Primary languages: ${techProfile.primaryLanguages.join(', ')}`,
            },
            {
              type: "text",
              text: `Frameworks: ${techProfile.frameworks.join(', ')}`,
            },
            {
              type: "text",
              text: JSON.stringify(techProfile, null, 2),
            },
          ],
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
    
        if (errorMessage.includes('GitHub integration not configured')) {
          return {
            content: [
              {
                type: "text",
                text: `❌ GitHub integration not configured`,
              },
              {
                type: "text",
                text: `To use tech stack analysis, please set GITHUB_TOKEN in your environment.`,
              },
              {
                type: "text",
                text: `Visit https://github.com/settings/tokens to create a personal access token with 'repo' scope.`,
              },
            ],
          };
        }
    
        if (errorMessage.includes('Unable to analyze tech stack')) {
          return {
            content: [
              {
                type: "text",
                text: `⚠️ Unable to analyze repository`,
              },
              {
                type: "text",
                text: errorMessage,
              },
            ],
          };
        }
    
        throw new Error(`Failed to analyze tech stack: ${errorMessage}`);
      }
    }
  • TypeScript interface defining the structure of the tech stack analysis output.
    export interface TechStackProfile {
      primaryLanguages: string[];
      frameworks: string[];
      testingFrameworks: string[];
      buildTools: string[];
      architecturalPatterns: string[];
      packageDependencies: 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/SDiamante13/learning-hour-mcp'

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