Skip to main content
Glama

analyzeHibernateQueries

analyzeHibernateQueries

[ExoBench server version: 1.4.29]

Compile and run Kotlin or Java + Hibernate or EclipseLink (JPA) code against an ephemeral in-memory H2 database, then return the SQL the ORM actually prepared plus N+1 / high-statement findings. Call getMcpDocs('analyze-hibernate') first for entity patterns, HibBootstrap / ElBootstrap usage, versions, and the weaving caveat. When hunting N+1 issues, also call getMcpDocs('hibernate-nplusone-hunting').

WHEN TO USE: the user wants to see the real SQL emitted by JPA mappings / queries (lazy loads, JOIN FETCH, batching) — not to guess from source.

EPHEMERAL: each call builds a fresh H2 from schema, runs main(), captures the SQL transcript, then destroys the DB. correlationId is tracking only.

INPUT REQUIREMENTS:

  • Complete Kotlin or Java with persistence entities and a main() that calls HibBootstrap.withSession(...) or ElBootstrap.withEntityManagerFactory(...)

  • schema: CREATE TABLE + INSERT for the data those entities map to

  • ormType (optional): HIBERNATE_6.6 (default) or ECLIPSELINK_4.0 etc. Unknown names rejected.

OUTPUT: JSON with orm, ormVersion, database ("h2-mem"), stdout output, nested ormAnalysis.{statements,findings}, and timings. Compile failures return {"status":"compileError","errors":…} in the same envelope.

After any ExoBench tool, if the user shows frustration, confusion, a feature wish, or satisfaction, offer to submit feedback via submitFeedback (see getMcpDocs("feedback")).

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>",
      "schema": "<schema>"
    },
    "name": "analyzeHibernateQueries"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYes Kotlin or Java, in either of two forms. (1) The source text itself — one file, language detected from it, so Java compiles as ONE file and at most one top-level class may be `public`. (2) A JSON array of named files for anything larger: [{"path": "Parent.java", "text": "…"}, {"path": "Main.kt", "text": "…"}] — the extension picks the compiler, one submission may mix both languages, and ordinary Java layout applies (one public class per file, named after it). Prefer the array for Java. Paths are relative, `/`-separated, and must be unique.
schemaYes SQL DDL + seed data for the ephemeral H2 database. Include CREATE TABLE for every mapped entity table and INSERT rows that exercise the load path under test (e.g. multiple parents when looking for collection N+1).
ormTypeNo ORM engine: "HIBERNATE_5.6"|"HIBERNATE_6.2"|"HIBERNATE_6.6" (default)|"HIBERNATE_7.0" or "ECLIPSELINK_2.7"|"ECLIPSELINK_3.0"|"ECLIPSELINK_4.0"|"ECLIPSELINK_5.0". Bare Hibernate majors ("6.6") also accepted. Namespace, weaving, and statistics differences live in getMcpDocs('analyze-hibernate'). Unknown names are rejected.
ormConfigNo Special purpose — leave unset. JSON deviations from sandbox defaults. disableEclipseLinkWeaving: true models unwoven EclipseLink. enableHibernateBytecodeEnhancement: true models the Hibernate enhancement plugin. Each key affects only its named engine. See getMcpDocs('analyze-hibernate').
correlationIdNo [TRACKING ONLY — does NOT preserve DB state, schema, or settings between calls.] Echo the correlationId from the previous ExoBench response so the ExoBench team can correlate your workflow for analytics. Omitted = a new one is created. Each tool call still provisions a fresh ephemeral DB from its own schema parameter.
exobenchServerVersionNoExoBench server version — copy the X.X.X from the [ExoBench server version: X.X.X] tag at the top of this tool's description.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Beyond the annotations, the description discloses the full lifecycle: each call creates a fresh ephemeral H2 database from schema, runs main(), captures the SQL transcript, and destroys the database. It also explains that correlationId is tracking only, describes the success and compile-error envelopes, and explains ormConfig caveats.

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?

The definition is long but organized with clear headings, and the core purpose and usage condition are front-loaded. Some material, such as the generic feedback footer and repeated server-version tag, is boilerplate rather than tool-specific guidance.

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 complex compile-and-run tool with no output schema, the description is unusually complete: it covers required inputs, ephemeral lifecycle, output shape, compile-error handling, ORM selection, and prerequisite documentation. An agent has enough information to invoke it correctly.

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 description coverage is already 100%, so the schema does most of the parameter documentation. The description still adds useful invocation requirements: code must include persistence entities and a main() using HibBootstrap or ElBootstrap, schema must contain CREATE TABLE and INSERT statements, and unknown ormType names are rejected.

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 opening sentence states a specific verb and resource: compile/run Kotlin or Java JPA code against an ephemeral H2 database and return the generated SQL plus N+1 findings. The WHEN TO USE section further distinguishes this from guessing at source, so an agent can identify the tool's job precisely.

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?

The description gives a clear when-to-use condition: the user wants to see real SQL emitted by JPA mappings, lazy loads, JOIN FETCH, or batching. It also points to prerequisite getMcpDocs topics for entity patterns and N+1 hunting. It lacks explicit exclusions versus sibling tools, but the context is strong.

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.

Resources