get_dependency_graph
Map Java type or package dependencies as nodes and edges to trace imports, inheritance, fields, parameters, and return types. Requires a loaded project.
Instructions
Get package/type dependencies.
USAGE: get_dependency_graph(scope="type", name="com.example.OrderService") USAGE: get_dependency_graph(scope="package", name="com.example.service") OUTPUT: Dependency graph with nodes and edges
Each node has a name and a kind. A node that denotes a type is named by the type's fully qualified name with '$' between nested types (com.example.Outer$Inner), however the source names it, so each type is one node. A node that denotes a type, or a member of one (a static import), also has the package of that type as JDT resolves it ("(default package)" for the default package). A node that denotes a package (every node at package scope, and an on-demand package import) has no package; neither has a name that does not resolve.
At package scope the graph covers the package and its subpackages: each import is an edge from the package of the file declaring it to the package it imports, and every edge's source and target is a node, as is the requested package. A name that is no package of the project's source folders, a library's package such as java.util included, is SYMBOL_NOT_FOUND.
depth is 1 or more at either scope; below 1 is INVALID_PARAMETER. At type scope it is how many steps of dependencies are followed from the type: 1 lists the type's own dependencies, 2 also those of each dependency with source, and so on. Package scope does not use it.
Dependency types tracked:
import: Direct imports
extends: Superclass inheritance
implements: Interface implementation
field: Field type dependencies
parameter: Method parameter types
return: Method return types
Requires load_project to be called first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Type name (fully qualified) or package name | |
| depth | No | How deep to follow dependencies, 1 or more (default: 1) | |
| scope | Yes | Scope: 'type' or 'package' | |
| includeExternal | No | Include JDK/library dependencies (default: false) |