query_workflow
Filter, traverse, and aggregate nodes in a workflow to answer targeted questions about node properties and dependencies without loading the entire JSON.
Instructions
QUERY a workflow file — filter, traverse, project, and aggregate over its nodes WITHOUT dumping the whole JSON (the missing middle between analyze_workflow's fixed summary and get_workflow's full dump; on 100+-node graphs this is the ONLY context-safe way to answer questions like 'which KSamplers run cfg>7', 'what feeds node 42', 'count nodes by type'). Provide exactly one of path/filename/graph, then combine: types (class_type contains any), title (contains), where widget predicates ANDed ('cfg>7', 'steps<=20', 'sampler_name=euler', 'text~sunset' — ops = != >= <= > < ~contains), ids (exact nodes — the way to read ONE node's detail), upstream_of/downstream_of + depth (dependency traversal: upstream = what FEEDS that node, downstream = what CONSUMES it; seed included at depth 0), fields ('compact' one line per node [default], 'ids', or 'detail' JSON rows with widgets + wiring), group_by:'type' (counts only), limit (default 40). Output is TOKEN-BOUNDED with an explicit truncation marker. For the LIVE canvas use panel_query_graph instead. Read-only.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ids | No | Keep exactly these node ids. | |
| path | No | Absolute server-side path to a workflow .json on disk. | |
| depth | No | Max hops from the traversal seed (seed=0). Absent = full closure. | |
| graph | No | Inline workflow JSON (UI or API format), as an alternative to path/filename. | |
| limit | No | Max nodes listed (default 40). | |
| title | No | Keep nodes whose title contains this. | |
| types | No | Keep nodes whose class_type contains ANY of these (case-insensitive). | |
| where | No | Widget predicates, ANDed: 'cfg>7', 'sampler_name=euler', 'text~sunset'. | |
| fields | No | Projection: compact one-liners (default), bare ids, or detail JSON rows. | |
| filename | No | Workflow filename in the ComfyUI userdata library, as an alternative to path. | |
| group_by | No | Aggregate: counts per class_type instead of listing. | |
| max_chars | No | Output character bound (default 12000). Raise only for deliberate full reads. | |
| upstream_of | No | Scope to the dependency closure FEEDING this node id. | |
| downstream_of | No | Scope to the nodes CONSUMING this node id's outputs. |