Skip to main content
Glama

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

NameRequiredDescriptionDefault
depthNoWith focus: how many hops to expand (1-5, default 1).
focusNoLimit to the neighbourhood of ONE element: its name, or 'type:name' to disambiguate (e.g. 'chunk:header'). Strongly preferred on big sites.
typesNoKeep only these node types.
formatNo'summary' returns only stats + missing + orphans (cheapest health check). Default 'graph'.
directionNoWith focus: 'out' = what it uses, 'in' = what uses it, 'both' (default).
max_nodesNoCap on returned nodes (default 1500).
verify_orphansNoCross-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_resourcesNoAlso add resources that elements link to via [[~id]] (default false).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.4

TDQS

A4.5/5.0
Behavior4/5

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

With no annotations, the description must carry the behavioral load, and it largely does: it discloses the reference-detection heuristics (MODX tags, `&tpl=` properties, `$modx->getChunk()/runSnippet()` in PHP, MIGX `inputTV`/`renderchunktpl`), the token-scaling property ('scales with the number of ELEMENTS, never with content'), and the semantics of `missing` and `orphans`. What it omits is permission/auth requirements and whether the operation is strictly read-only (implied by 'map'), which keeps it short of a 5.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with purpose, then return shape, then detection coverage, then usage — a sound information order with no filler sentences. It is dense with backticked identifiers and parentheticals, which makes it slightly heavy to scan, but nearly every clause carries distinct information.

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?

For an 8-parameter tool with no output schema and no annotations, the description compensates well by describing all four return collections and the node/edge structure. Remaining gaps are minor: the possible values of `edges.kind` are not enumerated and no permission or cost caveat is stated, but nothing prevents an agent from calling it correctly.

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?

Schema description coverage is 100%, so the 3 baseline applies; the description pushes past it by tying parameters to workflow — 'with `focus` before editing or deleting an element to see exactly what depends on it' and 'with format:"summary" as a fast health check'. It also gives a rationale for `verify_orphans`'s default (pages under 5000 resources) that the schema only gestures at. `depth`, `types`, `direction`, and `max_nodes` still depend on the schema for their meaning.

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 opens with a specific verb and artifact: 'Map how the site's elements WIRE TOGETHER', then enumerates exactly what relationships are captured (template→chunk/snippet/TV, snippet→chunk, TV attachments). It names what the return contains (`nodes`, `edges`, `missing`, `orphans`), so an agent can distinguish it from `modx_list_elements`, `modx_get_element`, and `modx_find_usages` without opening a schema.

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?

A dedicated 'USE IT:' block gives three concrete when-to-use scenarios (after `modx_project_overview`, with `focus` before editing/deleting, with format:'summary' as a health check). It explicitly contrasts with the nearest alternative, `modx_find_usages`, calling it a text search and positioning this tool as cheaper and more precise — a genuine routing decision, not just implied context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools