Skip to main content
Glama
FlyDut

Java Boilerplate Generator MCP

by FlyDut

generate_boilerplate

Generate getter/setter, equals/hashCode, toString, and constructors for Java entity classes and write them back to the source file. Fill missing accessors or regenerate all methods to replace Lombok.

Instructions

为 Java 实体类生成显式的样板方法并写回原文件(替代 Lombok)。

解析指定 .java 文件中的实体类,生成 IDE 标准风格的 getter/setter/ equals/hashCode/toString/无参构造/全参构造。

两个参数表达如何生成方法,互为补充:

  • generate(仅 getter/setter):只补缺失——只为缺少访问器的字段生成, 保留手写逻辑(如带校验的 setter)。

  • regenerate(全部 7 种皆可):删旧重建——删除旧方法后重新生成。这是 请求 equals/hashCode/toString/构造器的唯一途径(它们没有"只补缺失"模式), 也是把 getter/setter 从"补缺失"切换为"重建"的方式(适合改 setter 风格等)。

冲突:同一访问器类型(getter 或 setter)不能同时出现在 generateregenerate 中——"只补缺失"与"删旧重建"对同一访问器是矛盾的。冲突时工具 返回 error="conflict" 并给出说明,不写回文件,需重新调用二选一。

不传任何方法参数 = 生成全部 7 种(generate 默认 getter/setter 补缺失, regenerate 默认后 5 类删旧重建)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
generateNo要**只补缺失**的方法类型子集,**仅接受** `"getter"`、`"setter"`。 默认 `["getter","setter"]`。其余 5 类不能放这里,请用 `regenerate`。
file_pathYesJava 实体类的绝对路径。
regenerateNo要**删旧重建**的方法类型子集,可选值全部 7 种: `"getter"`、`"setter"`、`"equals"`、`"hashCode"`、`"toString"`、 `"no_args_ctor"`、`"all_args_ctor"`。默认后 5 类(equals/hashCode/ toString/构造器)——它们只能经此参数请求。把 getter/setter 列入 此参数则改为删旧重建(用于切换风格等重构)。注意:同一访问器不得 同时在 `generate` 与 `regenerate` 中,否则触发冲突错误。
setter_styleNosetter 返回风格,"void"(默认,传统)或 "fluent"(返回 this,支持链式调用)。void
include_super_fieldsNo为 true 时,equals 前置 super.equals(o)、 hashCode 加 super.hashCode()。要求父类也由本工具生成 equals/ hashCode(instanceof 模式),以保证父子类比较自洽。

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv0.1.0

TDQS

A4.8/5.0
Behavior4/5

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

With no annotations provided, the description carries the full burden and does disclose key behaviors: it writes back to the file, preserves handwritten logic in generate mode, deletes old methods in regenerate mode, and returns error="conflict" without writing on conflicts. It does not cover permissions or error cases like invalid file paths, but the core behavioral traits are clearly stated.

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 dense but well-organized: purpose is front-loaded, the two modes are clearly separated, and the conflict rule is highlighted. The length is justified by the conceptual complexity of the parameter interplay, and every sentence adds useful information.

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

Completeness5/5

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

For a five-parameter tool with no siblings, the description covers defaults, mode-specific usage, conflict outcomes, and the full set of method types. Combined with 100% schema description coverage and the presence of an output schema, nothing critical is missing for correct tool invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds substantial meaning beyond the schema. It explains the complementary semantics of generate vs regenerate, the defaults when parameters are omitted, and the conflict constraint that prevents certain combinations. This turns raw parameter lists into actionable decision guidance.

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 states a specific action: generate explicit boilerplate methods for Java entity classes and write them back to the original file. It names the seven method types covered, so the resource and scope are unambiguous even without sibling tools.

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

Usage Guidelines5/5

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

The description explicitly contrasts the two generation modes: generate is for filling only missing getters/setters, while regenerate is the only path for equals/hashCode/toString/constructors. It also warns about the conflict condition and tells the agent to choose one mode when a conflict occurs.

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/FlyDut/java-boilerplate-mcp'

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