Skip to main content
Glama

get_jpa_model

Assemble a Java project's JPA entity model from @Entity types, table names, ID fields, and relationships after loading the project.

Instructions

Assemble the project's JPA entity model.

USAGE: get_jpa_model() OUTPUT: Entities with table name, id field, and relationships (kind, target entity, mappedBy side), with locations.

Scans @Entity types (jakarta.persistence and javax.persistence) and reads @Table, @Id, and @OneToMany/@ManyToOne/@OneToOne/ @ManyToMany field annotations. Relationship targets are resolved from the field's type binding, including through collection type arguments (List -> Order).

Projects without JPA on the classpath return an empty model.

potentialMatches lists, the first maxResults by file and position, the @Entity annotations JDT could not confirm, each with the annotation it names; none is an entity.

Options:

  • maxResults: cap the reported entities (default 100)

potentialMatches, present only when there are any, holds the places JDT's search reports as possible matches but cannot confirm, because a type or name there does not resolve (a missing dependency or a compile error): count is their exact number, and locations lists them, as many as the results it stands beside may list. They are never counted or listed as results.

Requires load_project to be called first.

Input Schema

NameRequiredDescriptionDefault
maxResultsNoMaximum entities to return (default 100)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.5.0

TDQS

A3.9/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 burden and mostly succeeds: it explains that relationship targets are resolved through collection type arguments, that unresolvable types surface in potentialMatches and are never counted or listed as results, and that a non-JPA project returns an empty model rather than erroring. It never explicitly states the operation is read-only, but 'Scans/reads' makes the non-mutating nature clear.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The text is bloated and visibly damaged: potentialMatches is explained twice (an orphaned fragment near the top and again in a full paragraph at the bottom), and the fragment 'potentialMatches lists, the first maxResults by file and position, the @Entity annotations JDT could not confirm…' reads as a mis-pasted sentence. Redundant and garbled content hurts front-loading and clarity.

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 correctly takes on both the return contract (OUTPUT: entities with table name, id field, relationships and locations) and the edge-case behavior. It is complete enough to call and interpret the tool, though the duplicated/garbled potentialMatches prose slightly muddies the return contract.

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 description coverage is 100% and there is a single parameter, so the schema already documents maxResults fully; the description's 'cap the reported entities (default 100)' simply restates it. Baseline 3 is correct when the schema does the heavy lifting.

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?

It names a specific action and artifact — 'Assemble the project's JPA entity model' — and then specifies exactly what is scanned (@Entity types from jakarta/javax persistence plus @Table, @Id, and relationship annotations), which distinguishes it from generic type/hierarchy siblings like get_type_hierarchy or analyze_type.

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?

It states a hard prerequisite ('Requires load_project to be called first') and a boundary condition ('Projects without JPA on the classpath return an empty model'), which tells the agent when the call is meaningless. However it names no alternative sibling and gives no explicit 'use this instead of X when…' routing, so it falls short of full when/when-not guidance.

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