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'); }

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