Skip to main content
Glama

analyze_code_architecture

Analyze code architecture to assess design patterns, SOLID principles, scalability, and security. Submit your code, language, and specific question to receive tailored improvement recommendations.

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 actual handler function that executes the 'analyze_code_architecture' tool logic. It builds a query prompt with the code, language, and architectural question, then delegates to consultArchitecture() which calls the GLM-4.6 API.
      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);
      }
  • Input schema for the 'analyze_code_architecture' tool. Defines required 'code', 'language', and 'question' string properties with descriptions.
    {
      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:24-118 (registration)
    The tool is registered in the 'tools' array (line 44) which is returned via ListToolsRequestSchema handler (line 133). The array is defined at line 24.
    const tools: Tool[] = [
      {
        name: 'consult_architecture',
        description: 'Consult GLM-4.6 for expert software architecture guidance, system design patterns, scalability strategies, and technical decision-making. Use this for high-level architectural questions requiring deep technical expertise.',
        inputSchema: {
          type: 'object',
          properties: {
            query: {
              type: 'string',
              description: 'The architectural question or problem requiring expert consultation',
            },
            context: {
              type: 'string',
              description: 'Optional additional context about the system, requirements, or constraints',
            },
          },
          required: ['query'],
        },
      },
      {
        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'],
        },
      },
      {
        name: 'design_system_architecture',
        description: 'Design a complete system architecture based on requirements using GLM-4.6. Provides component breakdown, data flow patterns, technology recommendations, and deployment strategies.',
        inputSchema: {
          type: 'object',
          properties: {
            requirements: {
              type: 'string',
              description: 'Detailed system requirements, constraints, and objectives',
            },
          },
          required: ['requirements'],
        },
      },
      {
        name: 'review_technical_decision',
        description: 'Review and evaluate a technical decision using GLM-4.6 architectural expertise. Assesses impact, trade-offs, alternatives, risks, and provides recommendations.',
        inputSchema: {
          type: 'object',
          properties: {
            decision: {
              type: 'string',
              description: 'The technical decision to review',
            },
            context: {
              type: 'string',
              description: 'Context including current architecture, constraints, and objectives',
            },
          },
          required: ['decision', 'context'],
        },
      },
      {
        name: 'advanced_reasoning',
        description: 'Consult GLM-4.6 for advanced mathematical, algorithmic, and scientific reasoning tasks. Delivers world-class innovative solutions with rigorous methodology, optimal algorithms, and enterprise-grade quality. Use for: complex algorithms, mathematical proofs, performance optimization, advanced data structures, computational problems, scientific analysis. Response optimized for Claude 4.5 Sonnet with XML structure.',
        inputSchema: {
          type: 'object',
          properties: {
            task: {
              type: 'string',
              description: 'The specific mathematical, algorithmic, or scientific task requiring advanced reasoning',
            },
            context: {
              type: 'string',
              description: 'Comprehensive context including: problem domain, constraints, requirements, current approach (if any), performance requirements, business logic',
            },
            expected_outcome: {
              type: 'string',
              description: 'Detailed description of expected outcome: solution characteristics, performance targets, quality metrics, innovation requirements',
            },
          },
          required: ['task', 'context', 'expected_outcome'],
        },
      },
  • The MCP request handler case for 'analyze_code_architecture'. It destructures args (code, language, question), calls glmClient.analyzeCodeArchitecture(), and returns the response.
    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,
          },
        ],
      };
Behavior3/5

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

With no annotations, the description carries the full burden. It discloses the tool uses GLM-4.6 and evaluates specific aspects, but does not explicitly state whether it is read-only, what permissions are needed, or any potential side effects. The description is adequate but lacks depth.

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, well-structured sentence that efficiently communicates purpose and scope without unnecessary words. Every part adds value.

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

Completeness4/5

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

For a tool with three required parameters and no output schema or annotations, the description covers the key aspects of what is analyzed. However, it lacks information about the output format or structure, which would enhance completeness. Overall, it is nearly complete.

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 coverage is 100% (all parameters have descriptions in schema). The description does not add additional meaning beyond the schema—it focuses on overall analysis scope rather than parameter-specific details. Baseline score of 3 is appropriate.

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

Purpose5/5

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

The description clearly states it analyzes code from an architectural perspective using a specific model (GLM-4.6) and lists evaluation areas (design patterns, SOLID, scalability, security, improvements). This distinguishes it from siblings like 'consult_architecture' or 'design_system_architecture'.

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

Usage Guidelines3/5

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

The description implies the tool is for architectural analysis of code but provides no explicit guidance on when to use it versus siblings, nor does it mention prerequisites or exclusions. Usage is inferred but not clarified.

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

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