Skip to main content
Glama

get_type_hierarchy

Retrieve the complete inheritance chain for Java types, including superclasses, interfaces, and all subtypes, using either file position or type name lookup.

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
columnNoZero-based column number
filePathNoPath to source file (for position-based lookup)
lineNoZero-based line number
maxDepthNoMaximum depth of hierarchy to return (default 10)
typeNameNoFully qualified type name (alternative to position)
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the tool's behavior: it returns a hierarchy with supertypes and subtypes, requires a loaded project, uses zero-based coordinates, and accepts two input methods. However, it lacks details on error handling, performance, or output format specifics, which would be needed for a perfect score.

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 and front-loaded, with key information in the first sentence. Each section (USAGE, OUTPUT, input methods, IMPORTANT note, prerequisite) is concise and earns its place, avoiding redundancy. The bullet points for input methods enhance readability without unnecessary verbosity.

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?

Given the tool's moderate complexity (5 parameters, no output schema, no annotations), the description is largely complete: it covers purpose, usage, input methods, prerequisites, and a critical technical detail. However, without an output schema, it could benefit from more details on the return format (e.g., structure of the hierarchy), though the mention of 'Superclasses, interfaces, and all subtypes' provides some context. This minor gap prevents a perfect score.

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?

The schema description coverage is 100%, so the baseline is 3. The description adds significant value by explaining the semantics of parameters: it clarifies that 'filePath, line, column' are for position-based lookup and 'typeName' is an alternative, and it notes the zero-based coordinate requirement. It also mentions 'maxDepth' implicitly via 'full inheritance chain,' though not explicitly. This goes beyond the schema, warranting a higher score.

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 the specific action ('Get the type hierarchy') and resource ('for a Java type'), distinguishing it from sibling tools like 'get_type_at_position' or 'get_type_members' by focusing on inheritance relationships. It explicitly mentions what it returns ('superclasses, interfaces, and all subtypes'), making the purpose unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool: 'Position on a type, returns full inheritance chain' and 'Requires load_project to be called first.' It also specifies two alternative input methods (file position vs. type name) and includes an important technical note about zero-based coordinates, offering comprehensive usage context.

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