Skip to main content
Glama

generate_junit_test

Generate a JUnit 5 test class: real assertions from {input, expected|throws} cases, @Disabled tests for described cases, optional Mockito extension

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": {
      "className": "<className>",
      "methodName": "<methodName>"
    },
    "name": "generate_junit_test"
  }
}

Input Schema

NameRequiredDescriptionDefault
classNameYes
testCasesNoTest cases. Either a description string (generated as a pending test) or {name, input: [args...], expected} / {name, input, throws: true | "message"} for a real assertion.
methodNameYes
packageNameNoJava package (default com.example)
mockFrameworkNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • addedInput schema / properties / packageName
      Added value: +{
      +  "description": "Java package (default com.example)",
      +  "type": "string"
      +}
    • addedInput schema / properties / testCases / description
      Added value: +"Test cases. Either a description string (generated as a pending test) or {name, input: [args...], expected} / {name, input, throws: true | \"message\"} for a real assertion."
    • addedInput schema / properties / testCases / items / anyOf
      Added value: +[
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "properties": {
      +      "expected": {
      +        "description": "Expected return value (deep equality)"
      +      },
      +      "input": {
      +        "description": "Arguments (array) or a single argument"
      +      },
      +      "name": {
      +        "type": "string"
      +      },
      +      "throws": {
      +        "description": "true, or a substring of the expected error message"
      +      }
      +    },
      +    "required": [
      +      "name"
      +    ],
      +    "type": "object"
      +  }
      +]
    • removedInput schema / properties / testCases / items / type
      Removed value: -"string"
  2. First observed

TDQS

A3.8/5.0
Behavior4/5

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

With no annotations, the description carries the full behavioral burden, and it does disclose the key behaviors: real assertions are emitted for case objects with expected/throws, string cases become @Disabled pending tests, and Mockito support is opt-in. It stops short of saying whether output is returned as code or written to a file, or how existing files are handled.

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 front-loaded sentence with no filler; the brace notation packs the two case shapes compactly. The shorthand is slightly cryptic but every clause carries 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?

For a 5-parameter generator with no output schema and no annotations, the description covers the interesting behavior but omits what the call actually returns and leaves the two required parameters (className, methodName) semantically unexplained. It is adequate for choosing the tool but thin for invoking it correctly.

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 only 40%, so the description must compensate. It usefully explains the dual shape of testCases (descriptive string vs {name, input, expected|throws}) and what mockFramework toggles, but says nothing about className, methodName, or packageName beyond the schema's bare typing, leaving required parameters unexplained.

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?

States a specific verb and resource ("Generate a JUnit 5 test class") and names the framework, which is exactly the axis that separates it from the many sibling generators (jest, pytest, xunit, cypress, etc.). An agent can identify the correct generator without opening the schema.

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?

Usage is only implied by the framework name; there is no explicit when-to-use, no exclusion guidance, and no mention of how it differs from broader siblings like generate_test_suite or api_test_generator. An agent must infer that this is for Java/JUnit unit tests specifically.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.