Skip to main content
Glama

analyze_git_repository

Analyze Git repositories to detect stateful code patterns in .NET or Java projects and receive remediation guidance for migrating to stateless architectures.

Instructions

Analyze a Git repository for stateful code patterns in .NET or Java projects

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gitUrlYesGit repository URL (HTTPS or SSH)
sshKeyIdNoSSH key ID for private repositories (optional)

Implementation Reference

  • The MCP tool handler function that validates the gitUrl, calls the API client to analyze the repository, formats the result, and handles errors.
    async execute(args) {
      try {
        const { gitUrl, sshKeyId } = args;
    
        // Validate Git URL
        if (!gitUrl || (!gitUrl.startsWith('https://') && !gitUrl.startsWith('git@'))) {
          throw new Error('Invalid Git URL. Must start with https:// or git@');
        }
    
        // Call Statelessor API
        const result = await apiClient.analyzeGitRepository(gitUrl, sshKeyId);
    
        // Format result for Amazon Q
        return {
          content: [
            {
              type: 'text',
              text: resultFormatter.formatAnalysisResult(result),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error analyzing Git repository: ${error.message}`,
            },
          ],
          isError: true,
        };
      }
    },
  • Tool definition object containing the name, description, and input schema for validation.
    module.exports = {
      definition: {
        name: 'analyze_git_repository',
        description: 'Analyze a Git repository for stateful code patterns in .NET or Java projects',
        inputSchema: {
          type: 'object',
          properties: {
            gitUrl: {
              type: 'string',
              description: 'Git repository URL (HTTPS or SSH)',
            },
            sshKeyId: {
              type: 'string',
              description: 'SSH key ID for private repositories (optional)',
            },
          },
          required: ['gitUrl'],
        },
      },
  • mcp-server.js:51-68 (registration)
    Registration of tool handlers in the MCP server, dispatching tool calls to the appropriate execute function based on name.
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params;
    
      switch (name) {
        case 'analyze_git_repository':
          return await analyzeGitTool.execute(args);
        case 'analyze_local_project':
          return await analyzeLocalTool.execute(args);
        case 'generate_analysis_script':
          return await generateScriptTool.execute(args);
        case 'get_project_findings':
          return await getFindingsTool.execute(args);
        case 'explain_remediation':
          return await explainRemediationTool.execute(args);
        default:
          throw new Error(`Unknown tool: ${name}`);
      }
    });
  • mcp-server.js:38-48 (registration)
    Registration for listing available tools, including the analyze_git_repository tool definition.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          analyzeGitTool.definition,
          analyzeLocalTool.definition,
          generateScriptTool.definition,
          getFindingsTool.definition,
          explainRemediationTool.definition,
        ],
      };
    });
  • Helper function in API client that performs the actual HTTP POST request to the Statelessor API endpoint for git repository analysis.
    async analyzeGitRepository(gitUrl, sshKeyId = null) {
      const requestId = this.generateRequestId();
      
      try {
        const response = await this.client.post('/analyze', {
          type: 'git',
          gitUrl,
          sshKeyId,
        }, {
          headers: {
            'X-Request-ID': requestId,
            'Content-Type': 'application/json',
          },
        });
    
        return response.data;
      } catch (error) {
        throw this.handleError(error, 'analyzeGitRepository');
      }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While it mentions what gets analyzed (stateful code patterns in .NET/Java), it doesn't describe what the analysis produces, whether it's destructive, what permissions are needed, rate limits, or output format. This leaves significant behavioral gaps for a tool with no structured safety hints.

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 with zero wasted words. It's appropriately sized for the tool's complexity and front-loads the core purpose immediately.

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?

For a tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what the analysis produces, what 'stateful code patterns' entails, or how results are returned. Given the lack of structured fields, the description should provide more context about the tool's behavior and outputs.

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?

Schema description coverage is 100%, so the schema already documents both parameters thoroughly. The description doesn't add any parameter-specific information beyond what's in the schema (e.g., doesn't clarify what 'stateful code patterns' means in relation to the gitUrl parameter). Baseline 3 is appropriate when the schema does the heavy lifting.

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: analyzing Git repositories for stateful code patterns in specific tech stacks (.NET/Java). It specifies the verb 'analyze' and resource 'Git repository' with scope 'stateful code patterns', but doesn't explicitly differentiate from sibling tools like 'analyze_local_project' or 'get_project_findings'.

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?

No guidance is provided about when to use this tool versus alternatives. The description doesn't mention sibling tools like 'analyze_local_project' (for local projects) or 'explain_remediation' (for remediation guidance), leaving the agent to guess when this specific Git repository analysis tool is appropriate.

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/aloksinghGIT/statelessor-mcp'

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