Skip to main content
Glama

hot_reload

Apply Java code changes to a running Swing application without restarting it. Reloads changed classes and rebuilds affected screens, keeping state when possible.

Instructions

Apply code changes to the running application without restarting it. Workflow: edit the Java sources, compile them (e.g. mvn -q compile in the application's module, or let the IDE build), then call hot_reload. Changed classes are found in the class directories (target/classes) and loaded into the running JVM. If only event handlers, painting or business logic changed, open screens keep their state; if a screen's construction code changed (constructor, initComponents, @PostConstruct...), that screen is rebuilt. Changes that add or remove methods or fields (including new lambdas) cannot be applied on a standard JVM: the result explains which, and nothing is changed; then restart the application. Only classes whose code really changed are reloaded, even if the build rewrote all class files. In a multi-module project, a module that the application runs from its jar needs classesDir (or start the application with mvn swing2mcp:run -Dswing2mcp.classesDirs=...). Returns the new snapshot.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "hot_reload"
  }
}

Input Schema

NameRequiredDescriptionDefault
refsNoRefs of screens to rebuild in any case
rebuildNoauto (default): rebuild screens whose construction code changed; all: rebuild every open screen of a reloaded class; none: never
classesDirNoDirectory with compiled classes, if the application was not started from it (e.g. a module that runs from its jar)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does it well: it discloses preserved screen state vs. rebuilt screens, that failed structural reloads change nothing and report which members blocked them, that only genuinely changed classes reload even after a full rebuild, and the multi-module classesDir requirement. It also states the return value (the new snapshot), covering failure and side-effect behavior an agent must anticipate.

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?

Front-loaded with the one-line purpose, then a numbered-in-prose workflow and failure mode, so the reader gets the essentials immediately. It is dense but nearly every sentence carries operational detail; the parenthetical examples (mvn -q compile, target/classes, @PostConstruct) are the main source of bulk, though they also add concreteness.

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 no-annotation, three-parameter mutation-style tool with no output schema, the description covers prerequisites, failure handling, state effects, module caveats, and the return value. An agent could invoke it correctly without consulting anything beyond the schema.

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

Parameters4/5

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

Schema coverage is 100%, so baseline is 3, but the description adds real meaning beyond the schema: it explains why classesDir exists (a module run from its jar, or the mvn swing2mcp:run alternative) and ties rebuild semantics to screen construction code changes. Only 'refs' is left without added explanation beyond the schema text.

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: 'Apply code changes to the running application without restarting it.' The word 'without restarting' implicitly distinguishes it from the launch/stop lifecycle tools in the sibling set, and the follow-up sentences confirm the scope is class reloading into a live JVM.

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?

Gives a concrete pre-call workflow (edit, compile with mvn/IDE, then call) and a clear boundary condition: structural changes such as added/removed methods or fields cannot be applied, so restart instead. It does not name a specific sibling tool for the restart path (stop_app/launch_app) nor say when a plain restart is preferable to a reload, which keeps it short of a 5.

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