Skip to main content
Glama
cqfn
by cqfn

find_the_most_critical_design_issue

Analyzes a Java file to pinpoint the single most critical design flaw requiring immediate refactoring, improving maintainability, readability, cohesion, and coupling.

Instructions

Analyze one Java file. Find the most serious design flaw. It must need immediate refactoring. Ignore cosmetic or minor issues. Fix the one problem that will best improve code quality. Code quality means maintainability, readability, loose coupling, and high cohesion. Point out the problem and where it is in the file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • Main handler: the `aibolit` async function that checks the Aibolit version, validates the file exists, runs 'aibolit check --full', parses warnings by severity, picks the highest-priority issue, and returns a formatted message about the most critical design issue.
    export const aibolit = async function(path: string): Promise<string> {
      check_version();
  • src/tools.ts:10-32 (registration)
    Registration: the tool is registered on the MCP server via `server.tool()` with name 'find_the_most_critical_design_issue', a description prompt (wrapped with to_gpt), a Zod schema expecting a string `path`, and a handler that calls `safe(() => aibolit(path))`.
    server.tool(
      'find_the_most_critical_design_issue',
      to_gpt(
        `
        Analyze one Java file.
        Find the most serious design flaw.
        It must need immediate refactoring.
        Ignore cosmetic or minor issues.
        Fix the one problem that will best improve code quality.
        Code quality means maintainability, readability, loose coupling, and high cohesion.
        Point out the problem and where it is in the file.
        `
      ),
      { path: z.string() },
      async ({ path }) => {
        return ({
          content: [{
            text: await safe(() => aibolit(path)),
            type: 'text'
          }]
        });
      }
    );
  • Schema: the tool expects a single input parameter `path` of type string, validated with Zod's `z.string()`.
    { path: z.string() },
  • Helper: `safe` wraps the async call to `aibolit` in a try-catch, returning either the result or a formatted error string via to_gpt.
    export const safe = async function<T>(f: () => Promise<T>): Promise<T | string> {
      try {
        return await f();
      } catch (e) {
        if (e instanceof Error) {
          return to_gpt(e.message);
        }
        return to_gpt(String(e));
      }
    }
  • Helper: `to_gpt` normalizes whitespace and punctuation for GPT-friendly formatting, used both for the tool description and the final result.
    export const to_gpt = function(txt: string): string {
      return txt
        .replace(/\s+/g, ' ')
        .replace(/ (\?|!|\|,|:)/g, '$1')
        .trim();
    }
Behavior3/5

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

With no annotations, the description partially discloses behavior: it analyzes one Java file, ignores cosmetic issues, and identifies the problem with its location. However, it does not specify whether the tool is read-only or if it makes changes, nor how the analysis is performed or what the output format is.

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 extremely concise at 6 sentences, front-loaded with the core action, and each sentence adds unique value: scope, focus, exclusion criteria, quality definition, and output. No redundant or unnecessary information.

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

Completeness3/5

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

The description is adequate for a simple tool with one parameter and no output schema, explaining the core function clearly. However, it lacks details on output format, performance expectations, or edge cases (e.g., empty file, multiple flaws), which would enhance completeness given the tool's analytical nature.

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 only parameter is 'path', and the description clarifies it expects a Java file path, adding context beyond the bare schema. However, it does not detail the format or any constraints on the path, and schema description coverage is 0%, so the description provides minimal additional meaning.

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 tool name and description clearly indicate the tool identifies the most serious design flaw in a Java file, emphasizing critical issues over cosmetic ones. It distinguishes itself from a general code review tool by focusing on immediate refactoring needs.

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

Usage Guidelines4/5

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

The description specifies when to use the tool (to find critical design issues) and provides criteria for what constitutes a serious flaw (maintainability, readability, loose coupling, high cohesion). It implicitly advises against using it for minor issues, and with no sibling tools, this provides sufficient context.

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/cqfn/aibolit-mcp-server'

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