Skip to main content
Glama

Analyze Java Code

analyze_code
Read-onlyIdempotent

Detect complexity, code smells, and structural problems in Java source code to find issues early and guide targeted refactoring.

Instructions

Analyze Java source for complexity, smells and structural problems.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "code": "<code>"
    },
    "name": "analyze_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesSource code to analyze
languageNoProgramming language

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.1

TDQS

B3.2/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, non-destructive and closed-world, so the safety profile is covered. The description adds the analysis dimensions (complexity, smells, structure) but says nothing about limits, performance, or what the results look like.

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?

A single well-formed sentence with the analysis targets front-loaded and no wasted wording. Brevity is appropriate for a two-parameter read-only tool.

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?

No output schema exists, so the description must convey what comes back, and it only hints via 'complexity, smells and structural problems' without describing the report format. For a simple read tool this is adequate but leaves the agent guessing about results and the Java/language scope mismatch.

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 description coverage is 100% with only two simple parameters, so the schema carries parameter meaning adequately. The description adds nothing about the 'language' parameter, which is notable because its existence conflicts with the Java-only framing.

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?

States a specific verb (Analyze) and resource (Java source) plus the analysis targets: complexity, smells, structural problems. It implicitly distinguishes itself from analyze_javascript by naming Java, though the presence of a 'language' parameter slightly blurs that scoping.

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?

No guidance on when to use this versus analyze_javascript, analyze_springboot_project, or check_security, and no prerequisites or exclusions. The agent must infer the selection criteria from the name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.