modx_dependency_graph
Map how MODX templates, chunks, snippets, and TVs reference each other, then find broken references and orphaned elements. Use it to inspect dependencies before editing or deleting site elements.
Instructions
Map how the site's elements WIRE TOGETHER, in one call: which template pulls which chunk/snippet/TV, which snippet renders which chunk, where each TV is attached. Returns nodes (elements, with in/out reference degree) + edges ([from_index, to_index, kind]) — plus missing (tags pointing at a chunk/snippet that does NOT exist — broken references) and orphans (elements nothing references — safe-to-delete candidates). Detects references in MODX tags, &tpl=chunk`` properties, $modx->getChunk()/runSnippet() in PHP, MIGX inputTV/renderchunktpl, and template↔TV attachments. Token-safe: it scales with the number of ELEMENTS, never with content (resources are counts, not nodes). USE IT: to understand an unfamiliar site's code structure after modx_project_overview; with focus before editing or deleting an element, to see exactly what depends on it (cheaper and more precise than modx_find_usages, which is a text search); with format:"summary" as a fast health check for broken/dead elements.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "modx_dependency_graph"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| depth | No | With focus: how many hops to expand (1-5, default 1). | |
| focus | No | Limit to the neighbourhood of ONE element: its name, or 'type:name' to disambiguate (e.g. 'chunk:header'). Strongly preferred on big sites. | |
| types | No | Keep only these node types. | |
| format | No | 'summary' returns only stats + missing + orphans (cheapest health check). Default 'graph'. | |
| direction | No | With focus: 'out' = what it uses, 'in' = what uses it, 'both' (default). | |
| max_nodes | No | Cap on returned nodes (default 1500). | |
| verify_orphans | No | Cross-check orphan candidates against resource content, so chunks used only inside pages are not falsely listed. Defaults to on for sites under 5000 resources. | |
| include_resources | No | Also add resources that elements link to via [[~id]] (default false). |