Skip to main content
Glama

get_type_hierarchy

Retrieves the full inheritance chain for a Java type, including superclasses, interfaces, and all subtypes. Supports lookup by file position or qualified type name.

Instructions

Get the type hierarchy (supertypes and subtypes) for a Java type.

USAGE: Position on a type, returns full inheritance chain OUTPUT: Superclasses, interfaces, and all subtypes

Can be called with either:

  • File position (filePath, line, column) - finds type at cursor

  • Type name (typeName) - looks up type by qualified name

IMPORTANT: Uses ZERO-BASED coordinates when using file position.

Requires load_project to be called first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
lineNoZero-based line number
maxDepthNoMaximum depth of hierarchy to return (default 10)
typeNameNoFully qualified type name (alternative to position)
columnNoZero-based column number
filePathNoPath to source file (for position-based lookup)
Behavior4/5

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

No annotations are provided, so the description carries the full burden. It discloses coordinate system (zero-based), output components (superclasses, interfaces, subtypes), and the need for prior load_project. For a read-only tool, this is sufficient.

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 well-structured with clear sections (USAGE, OUTPUT, IMPORTANT) and uses bullet-like formatting for readability. Every sentence adds value without redundancy.

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?

The description covers key aspects: purpose, usage modes, output, and prerequisite. While no output schema exists, it mentions output components. In the context of sibling tools, it sufficiently differentiates itself.

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?

Input schema has 100% coverage with descriptions. The description adds meaning by clarifying the two usage modes (file position vs typeName), zero-based coordinates, and the maxDepth default of 10, complementing the schema.

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 clearly states it retrieves the type hierarchy (supertypes and subtypes) for a Java type, specifying two invocation modes (file position or type name). This distinguishes it from siblings like get_type_at_position or get_type_members.

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 explains when to use it ('Position on a type') and provides two calling options. It also notes the prerequisite of calling load_project first. However, it does not explicitly state when not to use it or mention alternatives.

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/pzalutski-pixel/javalens-mcp'

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