Trace dependencies
trace_dependenciesTrace formula references from one cell to the cells it reads or the cells that read it, up to five levels deep, to explain values, locate errors, or see input impact.
Instructions
Follow formula references from one cell in a session, breadth first, up to depth levels (1-5): direction "precedents" walks to the cells it reads, "dependents" to the cells that read it, and "both" (the default) does each. Returns {root, direction, max_depth, levels: [{depth, nodes: [{cell, formula, value, value_type}]}]} for one direction, or precedents and dependents (each a levels list) in place of levels for "both"; ranges are expanded to single cells and each cell is listed once per direction. Use it to explain where a number comes from, find the source of an error, or see what an input affects. For a cell's own formula use get_formula_range; for the whole graph at once use inspect_model with include_edges.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cell | Yes | Cell reference, optionally with sheet prefix (e.g. "B4" or "Sheet1!B4") | |
| depth | No | How many levels deep to trace (default 1, max 5) | |
| direction | No | "precedents" for the cells this cell reads, "dependents" for the cells that read it, "both" for each (default "both") | both |
| session_id | Yes | Session ID returned by create_session (list_sessions shows the open ones) |