Skip to main content
Glama

redefine_classes

Hot-swap modified Java classes into a running JVM debug session to apply code changes without restarting. Scans compiled .class files and updates loaded classes via JDI.

Instructions

Hot-swap changed Java classes into a running JVM. Scans a classes directory for .class files modified after sinceTimestamp, matches them against loaded classes in the target JVM, and redefines them using JDI. Returns which classes were redefined and the newest file timestamp (pass as sinceTimestamp on next call for incremental updates). Statement-anchored breakpoints are re-resolved against the new source after the swap (anchorResolution reports moved/stale). Only works with Java debug sessions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timeoutNoMax time (ms) to wait for the redefinition to complete (default: 30000, max: 600000). Increase when hot-swapping many classes at once
sessionIdYes
classesDirYesAbsolute path to compiled classes directory (e.g. build/classes/java/main/)
sinceTimestampNoUnix timestamp (ms). Only redefine .class files modified after this time. 0 or omitted = all files.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.25.1
    • addedInput schema / properties / timeout
      Added value: +{
      +  "description": "Max time (ms) to wait for the redefinition to complete (default: 30000, max: 600000). Increase when hot-swapping many classes at once",
      +  "type": "number"
      +}
  2. Addedv0.20.0

TDQS

A4.3/5.0
Behavior4/5

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

No annotations are provided, so the description carries full load, and it does well: it discloses the scan/match/redefine mechanism, the return payload, and an important side effect (statement-anchored breakpoints are re-resolved with moved/stale reporting via anchorResolution). It does not mention failure modes such as JDI's inability to change class schemas or permission requirements, which leaves a gap for a mutation tool.

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?

Four dense sentences, front-loaded with the core action before mechanism and side effects. Each sentence carries information (mechanism, return value, breakpoint side effect, constraint) with no filler, though the middle sentences are packed tightly.

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

Completeness4/5

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

With no output schema and no annotations, the description fills the gaps well by enumerating return values (redefined classes, newest timestamp) and behavior after the swap (anchorResolution moved/stale). It falls short only on failure conditions and environment requirements beyond 'Java debug sessions'.

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 75%, and the description adds real meaning beyond it by explaining the incremental pattern for sinceTimestamp (newest returned timestamp feeds the next call). timeout and classesDir are left to the schema, and sessionId is undescribed in both places, but the added semantics for the key parameter are valuable.

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 (hot-swap/redefine) and resource (changed Java .class files into a running JVM) and describes the mechanism (scan directory, match loaded classes, redefine via JDI). No sibling in the list does anything comparable, so an agent can distinguish it immediately.

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?

Clearly states the prerequisite audience ('Only works with Java debug sessions') and explains the incremental-update workflow (pass the returned newest timestamp as sinceTimestamp on the next call). It lacks explicit when-not guidance, but no sibling tool overlaps in function, so the routing context is effectively clear.

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