Skip to main content
Glama

get_type_hierarchy

Retrieve the full type hierarchy for a Java type, including superclasses, interfaces, and subtypes. Supports lookup by cursor 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
filePathNoPath to source file (for position-based lookup)
lineNoZero-based line number
columnNoZero-based column number
typeNameNoFully qualified type name (alternative to position)
maxDepthNoMaximum depth of hierarchy to return (default 10)
Behavior4/5

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

No annotations provided, but description discloses key behavioral traits: zero-based coordinates, requirement to have loaded project, and output content (superclasses, interfaces, subtypes). Clearly a read operation with no contradictions.

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?

Concise but complete: two sentences for purpose, followed by structured USAGE, OUTPUT, modes, important note, and prerequisite. Every sentence adds necessary information 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?

Given no output schema and no annotations, the description adequately covers prerequisites, coordinate system, and invocation modes. Could be more specific about the structure of the returned hierarchy, but it's sufficient for an agent to understand the tool's behavior.

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 covers all 5 parameters with descriptions. Description adds context: clarifies zero-based coordinates for line/column, default maxDepth=10, and distinguishes position-based vs typeName lookup. Adds value beyond 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?

Clearly states it retrieves type hierarchy (supertypes and subtypes) for a Java type, using a specific verb+resource. Distinguishes from siblings like 'get_type_at_position' and 'get_type_members' by focusing on inheritance chain.

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?

Provides explicit usage instructions: two modes (file position or type name), prerequisite (load_project), and coordinate system. However, does not include when-not-to-use guidance or 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