Skip to main content
Glama

codeReview

Analyze code to identify bugs, security vulnerabilities, and deviations from established best practices.

Instructions

Review code for bugs, security issues, and best practices

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesThe code to review

Implementation Reference

  • The handler function that executes the 'codeReview' tool logic. It currently returns a placeholder response indicating that actual code review is handled via LLM prompts.
    async ({ code }) => {
      try {
        // In a real implementation, this would call an LLM to review the code
        // For now, we'll just return a placeholder message
        return {
          content: [{ 
            type: "text", 
            text: "Code review functionality will be handled by the LLM through prompts."
          }]
        };
      } catch (error) {
        return {
          content: [{ 
            type: "text", 
            text: error instanceof Error ? error.message : String(error)
          }],
          isError: true
        };
      }
    }
  • The registration of the 'codeReview' tool using server.tool(), including name, description, schema, and handler.
    server.tool(
      "codeReview",
      "Review code for bugs, security issues, and best practices",
      {
        code: z.string().describe("The code to review")
      },
      async ({ code }) => {
        try {
          // In a real implementation, this would call an LLM to review the code
          // For now, we'll just return a placeholder message
          return {
            content: [{ 
              type: "text", 
              text: "Code review functionality will be handled by the LLM through prompts."
            }]
          };
        } catch (error) {
          return {
            content: [{ 
              type: "text", 
              text: error instanceof Error ? error.message : String(error)
            }],
            isError: true
          };
        }
      }
    );
  • Input schema for the 'codeReview' tool, defining the 'code' parameter.
    {
      code: z.string().describe("The code to review")
    },
  • Supporting prompt template for code review, which provides the LLM instructions for reviewing code, as referenced by the tool handler.
      server.prompt(
        "codeReview",
        "Prompt for reviewing code",
        {
          code: z.string().describe("The code to review")
        },
        ({ code }) => ({
          messages: [
            {
              role: "user",
              content: {
                type: "text",
                text: `SYSTEM: You are a code review assistant. Please review the provided code for:
    1. Bugs and logical errors
    2. Security vulnerabilities
    3. Performance issues
    4. Code style and best practices
    5. Potential improvements
    
    Be specific and provide actionable feedback.`
              }
            },
            {
              role: "user",
              content: {
                type: "text",
                text: `Please review this code:\n\n${code}`
              }
            }
          ]
        })
      );
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool reviews code but doesn't describe how it operates (e.g., static analysis, AI-based review), what permissions or resources it requires, or the format of results. This leaves significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without waste. It's appropriately sized for a simple tool, though it could be slightly more structured (e.g., by listing review aspects in bullet points) for better clarity.

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?

Given the tool's complexity (code review can involve nuanced analysis), lack of annotations, and no output schema, the description is incomplete. It doesn't explain what the review outputs (e.g., a list of issues, a summary), how comprehensive it is, or any limitations, making it inadequate for full contextual understanding.

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?

The input schema has 100% description coverage, with the 'code' parameter fully documented in the schema. The description adds no additional meaning beyond the schema, such as code language support or review depth, so it meets the baseline score of 3 for high schema coverage.

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 with specific verbs ('review code') and resources ('bugs, security issues, and best practices'), making it easy to understand what the tool does. However, it doesn't differentiate from potential sibling tools like 'think' or 'bash' that might also analyze code, preventing a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, context for code review, or compare it to sibling tools like 'think' for analysis or 'bash' for execution, leaving the agent with minimal usage direction.

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/auchenberg/claude-code-mcp'

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