Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
idsNoKeep exactly these node ids.
pathNoAbsolute server-side path to a workflow .json on disk.
depthNoMax hops from the traversal seed (seed=0). Absent = full closure.
graphNoInline workflow JSON (UI or API format), as an alternative to path/filename.
limitNoMax nodes listed (default 40).
titleNoKeep nodes whose title contains this.
typesNoKeep nodes whose class_type contains ANY of these (case-insensitive).
whereNoWidget predicates, ANDed: 'cfg>7', 'sampler_name=euler', 'text~sunset'.
fieldsNoProjection: compact one-liners (default), bare ids, or detail JSON rows.
filenameNoWorkflow filename in the ComfyUI userdata library, as an alternative to path.
group_byNoAggregate: counts per class_type instead of listing.
max_charsNoOutput character bound (default 12000). Raise only for deliberate full reads.
upstream_ofNoScope to the dependency closure FEEDING this node id.
downstream_ofNoScope to the nodes CONSUMING this node id's outputs.
Behavior5/5

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

With no annotations, the description fully discloses behavioral traits: it is read-only ('Read-only'), output is 'TOKEN-BOUNDED with an explicit truncation marker', and it explains traversal behavior (upstream feeds, downstream consumes, seed included at depth 0). No contradictions.

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

Conciseness5/5

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

The description is dense but well-organized: it front-loads the purpose and distinction, then systematically covers parameter combinations with examples. Every sentence adds value, and the structure (using dashes and semicolons) makes it scannable despite length.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 14 parameters and no output schema, the description covers all essential aspects: tool purpose, input selection, filtering, traversal, projection, aggregation, safety (token bounding), and alternatives. It leaves no major gaps for an AI agent to understand correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, but the description adds substantial meaning: examples for `where` predicates ('cfg>7', 'steps<=20', 'sampler_name=euler', 'text~sunset'), clarifies `upstream_of`/`downstream_of` semantics, specifies defaults (`limit` default 40, `fields` default 'compact', `max_chars` default 12000), and explains `group_by:'type'` behavior.

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 starts with a specific verb and resource ('QUERY a workflow file') and lists distinct capabilities (filter, traverse, project, aggregate). It clearly differentiates from siblings by positioning itself as 'the missing middle between analyze_workflow's fixed summary and get_workflow's full dump' and emphasizes its necessity for large graphs.

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?

The description explicitly states when to use this tool ('the ONLY context-safe way to answer questions like...'), provides a template for combining parameters ('Provide exactly one of path/filename/graph, then combine...'), and names an alternative for a different context ('For the LIVE canvas use panel_query_graph instead').

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/artokun/comfyui-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server