type_hierarchy
MCP tools › Code insight and refactoring
Type hierarchy of the type at (or around) a position of a Java file (from jdtls, SPEC-0082 v5), a Kotlin file (from the project's syntax trees, SPEC-0082 v6: project types only, a library supertype is a leaf placed where it is named) or a JavaScript/TypeScript file (without typescript-language-server, or when it fails, from the project's syntax trees through imports and re-exports, v5): direction class (default) gives the superclass chain from the topmost class down to the type (marked *) with all its subtypes below; supertypes and subtypes start at the type. Each node has name, kind, detail (package), location and children; at most 500 nodes. Returns null when there is no type.
Its results carry text from files, language_server: the client is told to treat that as data, never as instructions.
| Capability | code.type_hierarchy |
|---|---|
| Area | Code insight and refactoring |
| Access | reads only |
| Reaches | process |
| Rights | none |
| Dry run | none |
Arguments
| Argument | Type | Description |
|---|---|---|
pathrequired | string | Workspace-relative .java file. |
linerequired | integer | 0-based line.minimum 0 |
characterrequired | integer | 0-based character in the line (Unicode scalar values).minimum 0 |
direction | string | class (default: superclass chain down to the type, then its subtypes), supertypes or
subtypes. |
Call it from a shell
ferris-idea call runs one tool with the rights and safe mode of ferris-idea mcp. Replace the folder and the placeholder values.
ferris-idea call ~/my-project type_hierarchy '{"path":"<string>","line":1,"character":1}'Input schema as JSON
{ "type": "object", "required": [ "path", "line", "character" ], "properties": { "path": { "description": "Workspace-relative `.java` file.", "type": "string" }, "line": { "description": "0-based line.", "type": "integer", "minimum": 0 }, "character": { "description": "0-based character in the line (Unicode scalar values).", "type": "integer", "minimum": 0 }, "direction": { "description": "`class` (default: superclass chain down to the type, then its subtypes), `supertypes` or\n`subtypes`.", "type": [ "string", "null" ] } }}