Skip to main content
Glama

analyze_code_architecture

Analyze code architecture to evaluate design patterns, SOLID principles, scalability, and security, providing improvement recommendations for better system design.

Instructions

Analyze code from an architectural perspective using GLM-4.6. Evaluates design patterns, SOLID principles, scalability, security implications, and provides improvement recommendations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesThe source code to analyze
languageYesProgramming language of the code (e.g., typescript, python, go, java)
questionYesSpecific architectural question about the code

Implementation Reference

  • The core handler function that implements the tool logic. It constructs a specialized prompt including the code snippet, language, and question, then delegates to the GLMClient's consultArchitecture method for AI-powered analysis.
    async analyzeCodeArchitecture(code: string, language: string, question: string): Promise<string> { const query = `Analyze the following ${language} code from an architectural perspective: \`\`\`${language} ${code} \`\`\` Architectural Question: ${question} Provide analysis covering: 1. Architectural patterns used 2. Design principles adherence (SOLID, DRY, KISS) 3. Scalability considerations 4. Security implications 5. Recommended improvements`; return this.consultArchitecture(query); }
  • Defines the input validation schema for the tool, requiring code, language, and question parameters.
    inputSchema: { type: 'object', properties: { code: { type: 'string', description: 'The source code to analyze', }, language: { type: 'string', description: 'Programming language of the code (e.g., typescript, python, go, java)', }, question: { type: 'string', description: 'Specific architectural question about the code', }, }, required: ['code', 'language', 'question'], },
  • src/index.ts:43-64 (registration)
    Registers the tool in the MCP tools list with name, description, and schema.
    { name: 'analyze_code_architecture', description: 'Analyze code from an architectural perspective using GLM-4.6. Evaluates design patterns, SOLID principles, scalability, security implications, and provides improvement recommendations.', inputSchema: { type: 'object', properties: { code: { type: 'string', description: 'The source code to analyze', }, language: { type: 'string', description: 'Programming language of the code (e.g., typescript, python, go, java)', }, question: { type: 'string', description: 'Specific architectural question about the code', }, }, required: ['code', 'language', 'question'], }, },
  • src/index.ts:155-170 (registration)
    Dispatches tool calls in the MCP CallToolRequestHandler by matching the tool name and invoking the handler with parsed arguments.
    case 'analyze_code_architecture': { const { code, language, question } = args as { code: string; language: string; question: string; }; const response = await glmClient.analyzeCodeArchitecture(code, language, question); return { content: [ { type: 'text', text: response, }, ], }; }

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/bobvasic/glm-mcp-server'

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