RQL —
one query instead of thirty tool calls.
RQL (Reflection Query Language) is a pipeline language for querying and safely changing live object graphs. The agent uses it to read and edit an open Unity, Unreal Engine or Godot project through three MCP tools: rql-query, rql-mutate and rql-schema.
Overview
A query is a source followed by stages: source | stage | stage …. Every stage works on live editor objects, not on a JSON copy of the scene. Only the rows that survive filtering and projection are serialized and sent to the agent.
| Fact | Value |
|---|---|
| Package | NuGet com.IvanMurzak.Rql (each engine plugin bundles its own RQL runtime); QueryPlan protocol 0.1 |
| Runtimes | .NET (reference, with the text parser), TypeScript (parser and runtime), C++ (runs QueryPlans; no text parser) |
| Used by | Unity-MCP, Unreal-MCP and Godot-MCP: the same three tools in each |
| Safety | Read-only unless the mutation tool is used; all-or-nothing writes; undoable; budgets on every query |
| Spec and source | github.com/IvanMurzak/RQL: docs/language-reference.md, spec/semantics.md, docs/host-integration.md |
- One precise call replaces many exploratory calls: filter, project, sort, count and walk hierarchies in a single query.
- Compact table results use far fewer tokens than object-by-object JSON dumps.
- Errors come back as diagnostics with hints (an unknown member suggests the closest names), so the agent corrects itself.
- Bulk edits and bulk creation run in one all-or-nothing, undoable call:
range(0, 150) | call editor.CreateGameObject(…)builds a grid of 150 objects.
This reference follows the current RQL language. Each engine plugin bundles the RQL runtime it was built with, so recent additions (conditionals, text, vector and trigonometry functions, bulk create, arguments by name, max_targets and the default of 200 targets) need a plugin release whose runtime is newer than 0.2.0; older plugins keep a fixed limit of 20 targets. The rql-query and rql-mutate tool descriptions in your editor list what your version supports.
In the RQL repository's own evaluation (a DeepSeek agent on tasks with hidden answers; method and caveats in its RESULTS.md), RQL tools solved 100% of a fresh 90-task set written after tuning was frozen. A conventional reflection-tool baseline (find / dump object as JSON / set / call) solved 66.7% of the same set and cost 40× more per successful task.
Quick example
Find the three brightest lights in a Unity scene. Read the query left to right: every GameObject → its components → only lights brighter than 2 → brightest first → top 3 → three columns.
objects | get components | where $ is Light and intensity > 2 | sort intensity desc | first 3 | select gameObject.name intensity colorThe agent receives:
3 results
gameObject.name|intensity|color
Sun|3.5|(1, 0.96, 0.84, 1)
Torch_A|2.4|(1, 0.6, 0.2, 1)
Torch_B|2.2|(1, 0.6, 0.2, 1)Halve them, as a preview first (rql-mutate with dry_run: true). The receipt shows every planned write; nothing changes until the call runs without dry_run.
objects | get components | where $ is Light and intensity > 2 | set intensity = intensity / 2The receipt:
DRY RUN — nothing changed; 3 results
$ref|member|old|new
Light#24816|intensity|3.5|1.75
Light#24822|intensity|2.4|1.2
Light#24830|intensity|2.2|1.1Scene names, values and ids in these two results are illustrative.
The MCP tools
Unity, Unreal Engine and Godot register the same three tools with the same parameters. Each returns plain text (no structured output). A failed query comes back as a tool error.
| Tool | Parameters | What it does |
|---|---|---|
rql-query | query (string, required) | Read-only. Runs the query and returns compact rows. A query with set or call fails with permission-denied. |
rql-mutate | query (string, required) · dry_run (bool, default false) · max_targets (int, default 200, at most 1000; newer plugin releases) | The last stage must be set or call. All-or-nothing and undoable. dry_run: true returns the receipt and changes nothing. max_targets raises the target limit for an intended bulk change; it stays one undo step. |
rql-schema | type (string, optional) | Without a type: the sources, the functions and an overview of the types in the open scene or level. With a type ("Light", "PointLightComponent", "Node3D", "Vector3") or a source name ("editor"): its members (ro = read-only) and callable methods. Unknown types get suggestions. |
An MCP client sends standard tools/call requests:
{
"name": "rql-query",
"arguments": { "query": "objects | where name contains \"Enemy\" | select $ref name" }
}
{
"name": "rql-mutate",
"arguments": { "query": "objects | where name == \"Player\" | set active = false", "dry_run": true }
}
{
"name": "rql-schema",
"arguments": { "type": "Light" }
}The engine CLIs call the same tools from a terminal: unity-mcp-cli, unreal-mcp-cli and godot-cli run-tool rql-query --input '…' (see each engine below).
Syntax basics
The source is a path that starts with a registered source name (objects, actors, nodes …), a ref("Type#id") call, or a host function such as unity.assets("t:Material"). A path may continue from it: scenes[0].roots. A list value becomes the item stream, a map yields its entries, anything else is a single item. An unknown source fails with unknown-source and suggestions.
| Rule | Detail |
|---|---|
| Query shape | source | stage | stage …. Whitespace (space, tab, CR, LF) separates tokens and is otherwise ignored, so a query may span lines. |
| Identifiers | A letter or _, then letters, digits or _. Member lookup tries the exact name first, then a unique case-insensitive match. |
| Hyphens | A hyphen directly between two identifier segments, followed by a letter or _, is part of the name: starts-with, group-by, max-depth. a - b and a-1 are subtraction, so put spaces around a minus between two names. |
| Quoted names | Backticks quote a member name that is reserved or unusual: `null`, `my field`. |
| Dots | Always member access. ns.fn(x) calls a registered host function, such as unity.find("Player"). |
| Comments | None. Every character is part of the query. |
| Limits | At most 100 levels of expression nesting and 1000 operators. Number literals must be finite. Digits are ASCII only. |
| One query per call | Comparisons do not chain (a contains "x" == false is a syntax error; write not (a contains "x")), and a second query on a new line is reported as such. |
Pipeline stages
Each stage reads a stream of items and writes a stream of items. Terminal stages (count, sum / min / max / avg, describe, set, call) must be last; otherwise the query fails with invalid-plan. Examples use Unity member names; health and maxHealth stand for fields of a game script.
| Stage | Meaning | Example |
|---|---|---|
where <predicate> | Keeps the items whose predicate is true. Items where it is false or unknown are dropped. | where active and name contains "Enemy" |
select [alias=]<path> … | Projects each item to a row. A column is named by its alias or by its source text. Commas between columns are optional. Put a computed expression in parentheses. <expr> as <alias> also works. An alias cannot start with $. | select $ref name hp=(health / maxHealth) |
sort <key> [asc|desc], … | Stable sort. null and missing values go last in both directions. Mixed kinds order as number < string < bool < other. A key that fails (a division by zero, a getter that throws) sorts those items last and adds a warning naming the key. Put a computed key in parentheses. | sort (health / maxHealth) desc, name |
first [N] | The first N items (default 1). Stops reading upstream once it has them. limit N is an alias. | sort health | first 5 |
skip N | Drops the first N items. Use it with first for paging. | skip 50 | first 50 |
count | Terminal. Returns the number of items. | where $ is Light | count |
get <path> | Replaces each item by the value of the path. A list value is flattened into separate items. null and missing values are dropped. | get components |
recurse [via …] [max-depth=N] [include-self=false] | Depth-first, pre-order. Emits each item (depth 0) and then its descendants. With via members, only those members are followed. Without them, every owning object member is followed. Cycle-safe. max-depth defaults to 8. include-self=false drops the start items. | recurse children max-depth=3 |
distinct [<expr>] | Keeps the first item for each distinct value (default $). Objects compare by identity, projected rows by their column values, lists by their elements, structs (vectors included) by their members as they print. To list the values, project first. | select tag | distinct |
group-by <expr> | Replaces the stream by rows with members key and count, in order of first appearance. null and missing keys form one null group. Every row also has items, the group's items, for per-group aggregates. Not terminal. | group-by tag | select key, count, avg = items.avg(health) |
group-by [name=]<expr>, … | Several keys, or a named key: one row per combination, one column per key, then count. Group by type with $type. A key member most items lack gets a warning with the counts. | group-by $type, big=(mass > 10) |
sum | min | max | avg <expr> | Terminal aggregate. Skips null and missing values. sum of nothing is 0, the others are null. min / max also order strings. | get components | where $ is Rigidbody | sum mass |
describe | Terminal. Returns the schema of the distinct runtime types of the items: members, kinds and writability. | selection | describe |
set <path> = <expr>, … | Mutation, terminal. Assigns members on every item; values see the item as $, its position as $index and the stream size as $count. Allowed in rql-mutate only. | set transform.position.x = $index * 2 |
call <Method>(<args>) | Mutation, terminal. Invokes a method the host allowlists on every item. Allowed in rql-mutate only. | call AddComponent("Rigidbody") |
call <source>.<Method>(<args>) | Mutation, terminal. Runs the method of the one object the source yields, once per stream item, with $ and $index the item's: bulk create from range(…) or a list. Every call counts against the target limit. | range(0, 10) | call editor.CreateGameObject("Tile_" + $) |
<ns>.<stage> … | An extension stage registered by a host or module (namespaced). An unregistered name fails with unknown-stage. | (host-defined) |
Operators
Comparison
| Operator | Meaning | Example |
|---|---|---|
== · = | Equal. Numbers compare numerically. Strings compare case-sensitively. An enum equals its number or a name that resolves to it: exact, after a Type:: qualifier, ignoring case, or without the entry prefix ("Fill" → HAlign_Fill); editor display names work too. Objects compare by identity. null == null is true. Lists compare by value, in order. Two structs of one type compare member by member; vectors and colors within a small tolerance. | tags == ["a", "b"] |
!= | Not equal. null != x is true for any non-null x. | tag != "Untagged" |
< <= > >= | Order. Works on numbers, strings (ordinal) and enums (underlying value). Anything else gives unknown. | health < 20 |
contains | On strings: case-insensitive substring. On a list: membership using ==. | components.$type contains "Rigidbody" |
starts-with · ends-with | Case-insensitive prefix / suffix test on strings. | name starts-with "Enemy_" |
matches | Case-insensitive regex. The portable subset is literals, . * + ? ^ $ [] () | and \d \w \s. The .NET runtime limits each match to 50 ms. | name matches "^Enemy_\d+$" |
in · not in | == against each element of a list. | tag in ["Enemy", "Boss"] |
is null · is not null | Null test. An absent map entry is null; a misspelt member gives unknown, not true. | transform.parent is null |
is <Type> · is not <Type> | true when the runtime type, a base type or an interface has that short name (case-insensitive). The type may also be a string. | $ is Light |
Logical (three-valued)
Predicates are true, false or unknown. A comparison with a missing member or an error is unknown, and where keeps only true. So where not (health > 5) does not return objects that have no health: test with has(health).
| Operator | Meaning | Example |
|---|---|---|
and · && | Kleene AND: false and unknown is false. | active and health > 0 |
or · || | Kleene OR: true or unknown is true. | tag == "Enemy" or tag == "Boss" |
not · ! | Kleene NOT: not unknown is unknown. | not active |
cond ? a : b | Conditional, the same as if(cond, a, b): only the taken branch runs. Lowest precedence, so wrap it in parentheses inside select. | select kind=(intensity > 2 ? "bright" : "dim") |
Arithmetic
| Operator | Meaning | Example |
|---|---|---|
+ | Adds numbers. Concatenates when either side is a string. | name + " (copy)" |
- * / | Subtract, multiply, divide. Division by zero gives a div-by-zero error value. | health / maxHealth * 100 |
% | Remainder. Modulo by zero gives div-by-zero. | $index % 2 == 0 |
-x | Unary minus. A negated number literal folds into the literal. | transform.position.y < -10 |
| vectors | Vectors and colors compute component by component: v * n, n * v, v / n, v + w, v - w, v * w, v / w, -v, and a list of as many numbers on either side. v + n is a type-mismatch (add [x, y, z]); quaternions do not compute. | transform.localScale * 1.5 · transform.position + [0, 1, 0] |
| number lists | A list of numbers is a vector too: L * n, n * L, L / n, L + M, L - M (same length), -L. L * M is refused: use dot(a, b). | [transform.position.x, 0, transform.position.z] * 2 |
Vectors are computed where the engine marks them: Unity Vector2/3/4 and Color, Unreal Vector, Rotator and colors, Godot Vector2/3/4 and Color. Quaternions, matrices and transforms are not.
Precedence
| Level | Operators |
|---|---|
| 0 (lowest) | ? : conditional (right-associative) |
| 1 | or || |
| 2 | and && |
| 3 | not ! |
| 4 | comparison: == = != < <= > >= contains starts-with ends-with matches is in (one per expression, not chained) |
| 5 | + - |
| 6 | * / % |
| 7 | unary - |
| 8 (highest) | postfix: .member, [index], .method(args), (…) grouping |
Keywords and aliases
Eight words are reserved. To use one as a member name, quote it in backticks. The others are special only in their position.
| Word | Kind | Meaning |
|---|---|---|
and or not | reserved | Logical operators. |
in | reserved | List membership (x in [a, b], x not in […]). |
is | reserved | Null and type tests (x is null, $ is Light). |
null true false | reserved | Literals. |
asc desc | contextual | Sort direction, only after a sort key. |
as | contextual | Column alias in select (select health as hp). |
max-depth include-self | contextual | Options of recurse (max-depth=4, include-self=false). |
| stage names | contextual | where select sort first limit skip count get recurse distinct group-by sum min max avg describe set call are special only right after |. |
Accepted alternatives
The parser accepts these forms and canonicalizes them:
| You may write | Means |
|---|---|
= (in an expression) | == |
&& || ! | and or not |
limit N | first N |
select <expr> as <name> | select <name>=(<expr>) |
x is null / x is not null | x == null / x != null |
x not in L, x is not T | not (x in L), not (x is T) |
cond ? a : b | if(cond, a, b) |
WHERE, And, NULL, … | Keywords and core stage names in any letter case. |
Paths and meta members
| Form | Meaning |
|---|---|
a.b.c | Member access, chained. |
list[0] · list[-1] | Index from the start, or from the end. An index out of range is missing. |
map["key"] · map.key | Key lookup. A real member of the map type with that name (such as Count) wins for .key. ["key"] is always a key lookup. An absent key reads as null; has(map["key"]) tests whether it exists. |
list.member | Maps over the elements, skips missing results and flattens one level: components.$type is the list of component type names. |
list.Count · list.Length | The size of a list or map, in any letter case. .count() is the portable form. |
list.method(args) | A collection method (see below). Inside its arguments, $ and bare names refer to the element. A name the element lacks is looked up on the enclosing item. |
fn(args) · ns.fn(args) | A core function, or a host function registered by the engine. |
| a projected column | After select, rows have exactly their columns. A dotted path that equals a column name resolves to it (select owner.name hp | sort owner.name). A single-column row stands for its value. |
Meta members
| Meta | Value |
|---|---|
$ | The current item. Inside a collection method, the current element. |
$ref | A stable reference string Type#id, such as Light#1234. Objects without a stable id get a session handle Type@n. |
$type | The short runtime type name, without namespace or generic arity. |
$path | The navigation path by which the item was reached, e.g. objects[3].children[1]. |
$index | The zero-based position of the item in the stream that enters the current stage. In a set value or call argument: the target's position in the stream entering set / call. |
$count | In a set value or call argument only: the number of items entering the stage, so $index runs from 0 to $count - 1. |
$depth | During and after recurse: the depth below the start item (0 = start). Missing otherwise. |
Functions
Core functions work in every runtime. Numeric functions pass null, missing and error arguments through unchanged; any other non-number gives type-mismatch. List functions never change their argument: assign the result. Engines add namespaced functions (unity.*, unreal.*, godot.*), listed per engine below.
| Function | Result | Example |
|---|---|---|
has(path) | true if the path exists and every map lookup in it finds its key. The argument is not evaluated beyond the path. | where has(intensity) |
is-null(x) | Same as x is null. | where is-null(transform.parent) |
len(x) | String length, or list / map size. Missing for anything else. | where len(name) > 20 |
lower(s) · upper(s) | Invariant case conversion. | select lower(name) |
abs(n) · floor(n) · ceil(n) | Numeric. | where abs(transform.position.x) > 100 |
round(n[, digits]) | Rounds, optionally to a number of decimal digits. | select r=(round(health / maxHealth, 2)) |
sqrt(n) · pow(base, exp) | IEEE math. sqrt of a negative number is NaN. | select d=(sqrt(pow(transform.position.x, 2) + pow(transform.position.z, 2))) |
min(a, b, …) · max(a, b, …) | The smallest / largest of two or more numbers. One argument is an arity error. | select m=(max(health, 0)) |
sin · cos · tan · asin · acos · atan · atan2(y, x) | Trigonometry in radians. Results are rounded so the engines agree on the digits: sin(pi()) is 0. | set transform.position = [5 * cos(2 * pi() * $index / $count), 0, 5 * sin(2 * pi() * $index / $count)] |
pi() · deg(x) · rad(x) | π; radians to degrees (deg(atan2(1, 1)) is 45); degrees to radians. | select a=(deg(atan2(transform.forward.x, transform.forward.z))) |
length(v) · magnitude(v) | The length of a vector (a vector struct or a list of numbers). len stays the size of a string or list. | where transform.position.length() > 100 |
normalize(v) · distance(a, b) · dot(a, b) · lerp(a, b, t) | Vector functions. distance and dot return numbers; normalize and lerp a vector of the first argument's kind. | where distance(transform.position, unity.find("Player").transform.position) < 10 |
if(cond, a, b) | Conditional (also written cond ? a : b). Only the taken branch is evaluated, so it can guard an error. | set intensity = (intensity > 5 ? 5 : intensity) |
coalesce(a, b, …) | The first argument that has a value: not null, missing, unknown or an error (1 to 16 arguments). | select p=(coalesce(transform.parent.name, "(root)")) |
ref("Type#id", …) | Resolves stable references. Several ids, or a list of ids, give a list. A destroyed or unknown object gives stale-ref. | ref("GameObject#1234") |
append(list, v, …) | A new list with the values added at the end. | set targets = append(targets, ref("GameObject#1234")) |
insert(list, i, v) | A new list with v before index i. A negative i counts from the end, -1 appends. | set targets = insert(targets, 0, ref("GameObject#1234")) |
remove-at(list, i) | A new list without the element at i (negative counts from the end). | set targets = remove-at(targets, -1) |
without(list, v) | A new list without the elements equal to v. | set targets = without(targets, null) |
range(start, end[, step]) | The numbers from start up to end (excluded). As a query source it streams them, for bulk create. | range(0, 100) | call editor.CreateGameObject("Cube_" + $) |
replace(s, from, to) · replace-regex(s, pattern, repl) | Replace every occurrence (case-insensitive), or every regex match ($1 inserts group 1). | set name = name.replace("Pillar_", "Column_") |
substring(s, start[, length]) · split(s, sep) · trim(s) · pad(v, width[, fill]) | Text helpers. Positions clamp to the string; pad(3, 2) is "03". | set name = "Tile_" + pad($index, 3) |
contains(a, b) · starts-with(a, b) · ends-with(a, b) · matches(a, b) | Function forms of the operators. | where starts-with(name, "UI_") |
Collection methods
Called on a list or map value: list.method(args). Arguments are evaluated per element, with $ as the element.
| Method | Result | Example |
|---|---|---|
.any([pred]) | true if some element matches. With no predicate: the collection is not empty. | components.any($ is Light) |
.all(pred) | true if every element matches. An empty collection gives true. | children.all(active) |
.count([pred]) | The number of elements, or of matching elements. | children.count(active) > 3 |
.first([pred]) | The first element, or the first matching one. Missing when there is none. | components.first($ is Collider) |
.sum([e]) · .avg([e]) | Sum / average of e over the elements; non-numbers are ignored. Empty: sum gives 0, avg gives null. | children.sum(transform.position.y) |
.min([e]) · .max([e]) | Smallest / largest of e; also orders strings. Empty gives null. | children.max(transform.position.y) |
.keys() · .values() | The keys or values of a map. | {a: 1, b: 2}.keys() |
.contains(x) · .starts-with(x) · .ends-with(x) · .matches(x) | Method forms of the operators. | name.starts-with("Enemy") |
.lower() · .upper() · .len() | Method forms of the functions. | name.len() |
.replace(…) · .substring(…) · .split(…) · .trim() · .pad(…) | Method forms of the text functions. | name.substring(0, 4) |
.length() · .normalize() · .distance(b) · .dot(b) · .lerp(b, t) | Method forms of the vector functions. | transform.position.distance([0, 0, 0]) |
Literals
| Kind | Syntax | Notes |
|---|---|---|
| Number | 42 1.5 2e-3 -7 | ASCII digits. Write 0.5, not .5. A unary minus folds into the literal. |
| String | "Player" 'Player' | Escapes: \" \' \\ \n \t \r \uXXXX. Any other escape keeps its backslash, so "a\.b" reaches a regex unchanged. |
| Boolean | true false | Any letter case. |
| Null | null | Any letter case. |
| List | [1, 2, 3] ["Enemy", "Boss"] [] | Elements are any expressions. |
| Object | {x: 1, y: 2} {$type: "FastSettings", speed: 2} {} | Keys are names, strings or $-names, unique and non-empty. Behaves as a map. On a write it builds the value (see Conversion on writes); as the only call argument it can pass arguments by name. |
| Engine value text | "(0, 1, 0)" "#ff8800" | Plain strings that engine type adapters convert on writes and comparisons: vectors, rotations, colors. |
Values and types
Every expression evaluates to one of these kinds. missing, null and error stay distinct.
| Kind | Meaning |
|---|---|
missing | The path does not exist on this value: no such member or index. An absent map key is not missing: it reads as null. |
null | The member exists and its value is null. |
error | Evaluation failed: a getter threw, division by zero, a type mismatch. Carries a code. |
| bool, number, string | Scalars. Numbers compare numerically, whatever the runtime's int / float types. |
| enum | Compares to strings by name (case-insensitive) and to numbers by underlying value. |
| object | A reference-like runtime object with identity. Has a $ref. |
| struct | A value type (e.g. Vector3). No identity. == compares two of one type member by member; vectors and colors also compute component by component. |
| list | An ordered collection: array, list, set, or any enumerable that is not a string or map. |
| map | Key → value. Iterating it yields entries with key and value; other members of an entry read from its value. |
Conversion on writes
set and call arguments are converted to the target type. A value that does not convert fails with coercion-failed.
| Target type | Accepts |
|---|---|
| Integer | A number with an integral value that fits the type. |
| Enum | Its name as a string (type = "Spot"), qualified ("LightType::Spot"), in any case, or the editor's display name. An ambiguous name fails and lists the candidates. |
| Nullable or reference type | null. |
| List or array | A list literal ([a, b]). |
| Map | An object literal, entry by entry. |
| Class or struct | An object literal. The value is constructed and the named members are assigned; members not named keep their defaults. $type picks a concrete subtype. Plain data and value-like assets (Godot resources, Unity materials and data ScriptableObjects) are built this way; owned subobjects such as Unreal input triggers are built for the object they are written into. |
| Scene object | Never built from a literal (game objects, components, actors, nodes): pass an existing one, or create it with an engine call (CreateGameObject, SpawnActor, CreateNode). |
| Vector, rotation, color … | What the engine adapter accepts: "(1, 2, 3)", [1, 2, 3], {x: 1, y: 2, z: 3}; colors also "#rrggbb". |
| Object reference | ref("Type#id"), the engine's find function, or an asset path string (Unity "Assets/…", Unreal "/Game/…", Godot "res://…"). |
Results
The tools return the compact table format:
| Part | Format |
|---|---|
| Diagnostics (first, optional) | error <code>: <message> — hint: <hint> or warning …, one per line |
| Header | 1 result, N results, or N of M (truncated; page with skip N | first M, or count); a dry run starts with DRY RUN — nothing changed; |
| Columns | col|col|…: the select columns, or the receipt columns |
| Rows | One per line. Objects show as Type#id(Name), vectors and colors as (x, y, z), structs and maps as {k:v,…}, lists as [a,b]. Strings are unquoted unless ambiguous. Numbers show at most 15 significant digits. |
| Scalars | count and aggregates print the bare value, e.g. 3. |
| Receipts | set: $ref|member|old|new (new is read back after the write); assignments that kept the value are counted (“N unchanged assignment(s) not listed”), not listed. call: $ref|method|result (a created object's $ref is in result). Long receipts list the first 50 rows with a count of the rest; a call receipt prints a method shared by every row once and drops a $ref equal to the result's. |
Without select, every item is one row showing the object itself. Long lists in a cell are cut after 20 items with a …+N marker. Page large results with skip N | first M, or ask for count first.
Mutations
| Rule | Behavior |
|---|---|
| Two switches | Writes need a host that enables them and a request that allows them. rql-query can never write; rql-mutate must end with set or call (else invalid-plan). |
| All-or-nothing | Every target and value is resolved, converted and validated before the first write. If a write fails midway, the values already written are restored. |
| Targets | Objects with identity, or handle structs whose adapter writes through (Unity Scene). For set and a plain call, a scalar or a plain struct copy (get transform.position) is refused with invalid-plan (a source-qualified call takes any items); write through the owner instead: set transform.position.y = transform.position.y + 1. |
| Target limit | At most 200 targets (or bulk-create items) per call by default (newer plugin releases; older ones keep a fixed limit of 20) (mutation-limit, nothing written). The limit guards against a filter wider than intended, not against size: pass max_targets (up to 1000) for an intended bulk change, or narrow with where, first or ref(). Beyond 1000, split into batches (re-run with first 1000 when the change removes items from the filter). |
| Bulk create | range(0, N) or a list literal streams items, and call editor.Create…(… $ …) runs once per item: N new objects in one call and one undo step, every item checked before the first is created. |
| Arguments by name | One object literal as the only argument binds its keys to parameter names; the rest keep their defaults: call CreateGameObject({name: "Crate", primitive: "Cube"}). |
| Map entries | … | get properties | where Key ends-with "Color" | set Value = "#ffffff" writes through the map the entries came from. |
| Typos fail | A misspelt member that leaves set / call nothing to change is an unknown-member error (nothing changed). A real member that the matched items lack is a warning with 0 changes. |
| Object literals | set settings = {speed: 2, $type: "FastSettings"} builds a new value. Members not named get defaults, so patch single members with paths instead. Scene objects are never built from literals. |
call validators | Methods may declare a validator. It runs for every target before the first call, on dry runs too; a rejection is invalid-value and nothing is called. |
call is not rolled back | A method that throws stops the stage with call-threw; calls already completed stay done. |
| Dry run | dry_run: true computes the receipt without writing. new is then the planned value. |
| Undo | Each rql-mutate call is one undo step in the editor (Ctrl+Z). |
Errors and diagnostics
A diagnostic has a severity, a code, a message and often a hint. Warnings do not stop the query. The codes are a closed set per release; treat an unknown code as a generic error. Engines add a few of their own: not-found and ambiguous from the find functions, and the not-saved warning after a write.
| Code | Severity | When |
|---|---|---|
syntax-error | error | The text does not parse. The message gives the position. |
invalid-plan | error | A structurally invalid query: a terminal stage that is not last, a mutation request without set / call, a scalar mutation target. |
version-unsupported | error | A QueryPlan with an unknown protocol version. |
unknown-source | error | The first path segment is not a registered source. Comes with suggestions. |
unknown-stage · unknown-function | error | No such stage or function is registered. |
unknown-member | warning / error | No evaluated item had that member. The hint names the closest members ("did you mean …?"), nested struct members and the types that do have it. An error when such a typo leaves set / call nothing to change. |
unknown-meta | warning | An unknown $name meta member. |
no-match | warning | An x is T test was false for every item. The hint says where T objects are reachable. |
type-mismatch | error / warning | Wrong operand kinds, or a condition that is not a boolean (where material instead of where material != null). As a warning: an aggregate ignored values (it says how many). |
arity | error | Wrong number of arguments. |
div-by-zero | error | Division or modulo by zero. |
getter-threw · call-threw · function-threw | error | A member read, a called method or a host function threw. |
hook-threw | warning | A host hook threw after the writes were committed. |
invalid-regex | error | A matches pattern does not compile. |
stale-ref | error | ref() points to an object that no longer exists. Re-query for a fresh $ref. |
permission-denied | error | set / call in a read-only request, or a member or method the host does not allow. |
readonly-member | error | The member cannot be written (identity members are always read-only). |
coercion-failed | error | The value cannot be converted to the member type. |
invalid-value | error | The value converts, but the host's validation rejects it (also a call validator), or max_targets is outside 1 to 1000. |
mutation-limit | error | More targets than the target limit. Nothing was changed. The message says how many matched; the hint gives the max_targets that would cover them. |
budget-exceeded | error / warning | Too many objects visited; partial results are discarded. As a warning: recurse max-depth was clamped to maxDepth (the rows are kept). |
timeout | error / warning | The query ran out of time, or one regex match did (warning). |
output-truncated | warning | The rows were cut to the output size budget. For a receipt, only the listing is cut: every change was made. |
unsupported | error | The runtime cannot do this, e.g. text sent to a plan-only runtime. |
internal-error | error | A runtime bug reported as a diagnostic instead of a crash. |
Budgets and limits
Every query runs under budgets. The engine plugins use the defaults below. The only one a tool call can raise is the target limit: rql-mutate takes max_targets in newer plugin releases (older ones have no parameter and a fixed limit of 20).
| Budget | Default | Hard cap | On exceed |
|---|---|---|---|
maxRows (returned rows / items) | 50 | 10 000 | Truncation (N of M (truncated; …)), not an error. |
maxVisited (items, recursion nodes, method elements) | 1 000 000 | 5 000 000 | budget-exceeded. |
timeoutMs | 2 000 | 30 000 | timeout. |
maxListItems (per encoded list) | 20 | – | Truncation marker …+N. |
maxDepth (recurse cap) | 16 | – | Clamp plus a budget-exceeded warning. |
recurse default depth | 8 | – | max-depth=N overrides it. |
maxOutputBytes | 65 536 | – | Rows cut plus output-truncated. |
Target limit (max_targets) | 200 in newer plugin releases (older ones and the library default: 20, fixed) | 1 000 | mutation-limit, nothing written. Raise it per call with max_targets. |
Engine caps on top: asset and resource lists return at most 200 entries; the console sources keep the last 1000 log entries in Unity and Godot and 10 000 in Unreal; Godot's files lists at most 20 000.
Security
RQL treats query text from an agent as untrusted input that runs inside the editor process.
- No arbitrary code execution. No eval and no file-system or process access in the language.
callreaches only methods the host allowlists ([RqlCallable]in .NET, or methods an adapter adds); anything else ispermission-denied. - Only exposed members are read. A getter that throws becomes an error value plus a
getter-threwwarning. - Identity is read-only. The member behind
$refcan never be written. - Stale references are detected. A destroyed object reads as
null, andref()to it isstale-ref. - Regexes are bounded. The .NET runtime limits each
matchesto 50 ms.
The policy limits what can be written, not whether the change was wise. Hosts should allowlist destructive methods sparingly, and dry runs are worth using for bulk edits.
RQL in the engines
The language is the same everywhere. What differs is the object model: the sources, the member names, the host functions and calls, and what happens after a write. In each engine, rql-schema lists all of it, including what installed extensions add.
| Unity | Unreal Engine | Godot | |
|---|---|---|---|
| Runtime in the editor | .NET assemblies (Rql.Contracts, Rql.Parser, Rql.Execution), Editor-only | C++ runtime inside the plugin; the unreal-mcp-bridge sidecar (.NET) parses the text | .NET NuGet com.IvanMurzak.Rql, editor builds only |
| Every object | objects (GameObjects) | actors | nodes |
| Hierarchy roots | roots | actors | where Parent == null | root |
| Find by name / path | unity.find("Level/Pillar_1") | unreal.find("Lamp") (label, name or path) | godot.find("Level/Player") |
| Assets | unity.assets("t:Material"), unity.asset(path) | unreal.assets("StaticMesh", "/Game/Props"), unreal.asset(path) | godot.resources("StandardMaterial3D"), godot.resource(path) |
| Member names | C# members: transform.position, intensity | Reflected property names (Intensity, bHidden, RelativeLocation) plus added members such as Label, Location | C# properties Position, plus props["snake_case"] |
$ref | GameObject#<id> | PointLight#<id> (valid for the editor session) | Node3D#<instance id> |
| Undo | One Undo group "RQL mutation" | One editor transaction "RQL: <query>" | One undo step "RQL: <query>" (a change to both scene and files records a scene part and a file part, undone together) |
| Bulk create | range(0, N) | call editor.CreateGameObject(…), editor.InstantiatePrefab(…) | range(0, N) | call editor.SpawnActor(…) | range(0, N) | call editor.CreateNode(…), editor.InstantiateScene(…) |
| Saving after a write | Saves changed assets, the open prefab and dirty scenes (not untitled scenes, not in Play Mode) | Nothing is saved, except Project Settings and gameplay-tag edits (written to their .ini at once, not undoable). Call SaveLevel / SaveAll / SaveAsset | Resource files are saved. Scene edits mark the scene unsaved; call editor | call SaveScene() |
Unity
Since Unity-MCP 1.0.0, RQL is the plugin's data layer: GameObjects, components, assets, scenes, prefabs, console logs, the profiler and Editor state are all read and changed through RQL. Members are the C# members (public and [SerializeField]).
Sources
| Source | Items |
|---|---|
objects | Every GameObject in the loaded scenes, depth-first, inactive ones included. |
roots | Root GameObjects of the loaded scenes. |
scenes | Loaded scenes: name path buildIndex isLoaded isDirty rootCount roots; calls Save(), SaveAs(path), SetActive(), Close(). |
selection | Objects selected in the Editor. |
prefab | The root GameObject of the prefab open in prefab editing mode (none otherwise). |
console | Captured Editor log entries, oldest first (last 1000): logType message timestamp stackTrace sequence. |
shaders | Every shader the Editor knows: name supported hasErrors. |
componentTypes | Component types that can be added: name fullName namespace. |
tests · testResults | Test methods (fullName name fixture namespace assembly mode categories …) and the results of the last tests-run. |
profiler | Live profiler snapshots: memory rendering script frame modules; calls Start, Stop, ClearFrames, EnableModule, Save, Load. |
lighting | The active scene's lighting: environment (ambient, fog, skybox, sun), the Lighting Settings asset, baking. |
settings | Project Settings: physics, time, quality, player, build (writable, saved and undoable; build.scenes lists the scenes in the build). |
editor | Editor state (isPlaying isPaused isCompiling selection unityVersion projectPath layers tags) and operations (below). |
Functions
| Function | Returns |
|---|---|
unity.assets(filter, folder?) | An AssetDatabase search such as "t:Material" or "t:Prefab Enemy", at most 200 assets, loaded lazily. |
unity.asset(path) | The main asset at a path, or null. |
unity.find(nameOrPath) | The GameObject with that hierarchy path or unique name. not-found / ambiguous otherwise. |
ref("GameObject#1234") | Resolves a $ref from an earlier result. |
Object model
- GameObject:
name,active(writes call SetActive),tag(a defined tag),layer(0–31),staticFlags(list of names),transform,components,children. - Transform:
position,localPosition,eulerAngles,localScale,parent(writable, keeps the world position),root. - Components: find them with
objects | get components | where $ is Light; each hasgameObjectandtransform. - Material:
name shader renderQueue …plusproperties["_Color"], typed per shader property. Renderermaterial/materialsare the shared materials. - Values: vectors, quaternions and colors print as
(x, y, z); write"(1, 2, 3)",[1, 2, 3]or{x: 1, y: 2, z: 3}; colors also"#ff8800". PrefereulerAnglesfor rotations. An asset path string ("Assets/…") works wherever an asset is expected.
Calls
| On | Methods |
|---|---|
editor | CreateGameObject(name, parent?, primitive?, position?, rotation?, scale?) or CreateGameObject(name, {primitive, parent, position, rotation, scale}) · InstantiatePrefab(path, parent?, position?, rotation?, scale?) or InstantiatePrefab(path, {parent, position, rotation, scale}) · AddLayer(name) · AddTag(name) · OpenScene(path, additive?) · NewScene(path, empty?, additive?) · SaveScenes() · OpenPrefab(path) · SavePrefab() · ClosePrefab(save?) · CopyAsset(path, newPath) · MoveAsset(path, newPath) · DeleteAsset(path, force?) · CreateFolder(path) · CreateMaterial(path, shader?) · SaveAssets() · RefreshAssets() · ClearConsole() · ExecuteMenuItem(path) |
| GameObject | AddComponent(type) · Destroy() · Duplicate() · SaveAsPrefab(path) · ApplyPrefabOverrides() · RevertPrefabOverrides() · LookAt(target) (a GameObject or a position) |
| Component | Destroy() (refused for Transform and for components another one requires) |
| Scene | Save() · SaveAs(path) · SetActive() · Close() |
Examples
Queries (rql-query):
objects | where name contains "Enemy" and active | select $ref name transform.position
objects | get components | where $ is Light and intensity > 2 | select gameObject.name intensity color
roots | recurse children | where components.count() == 1 | select $path name
unity.assets("t:Material") | select name shader.name properties["_Color"]
console | where logType == "Error" | sort sequence desc | first 5 | select message
scenes | select name path isDirty rootCount
componentTypes | where name contains "Collider" | select name
editor | select isPlaying isPaused selection
settings | select physics.gravity time.fixedDeltaTime quality.levelsChanges (rql-mutate):
objects | where name == "Player" | set transform.position = "(0, 1, 0)"
objects | get components | where $ is Light | set intensity = intensity * 2, color = "#ffcc88"
objects | where tag == "Enemy" | set active = false
objects | where name starts-with "Pillar_" | set name = name.replace("Pillar_", "Column_")
objects | where name starts-with "Coin" | set transform.localScale = transform.localScale * 1.5
objects | where name starts-with "Enemy" and distance(transform.position, unity.find("Player").transform.position) < 10 | set active = false
unity.asset("Assets/Mats/Red.mat") | set properties["_Color"] = "(1, 0, 0, 1)"
editor | call CreateGameObject("Crate", ref("GameObject#1234"), "Cube")
range(0, 150) | call editor.CreateGameObject("Cube_" + $, {primitive: "Cube", position: [($ % 15) * 2, 0, floor($ / 15) * 2]})
editor | call CreateGameObject({name: "Crate", primitive: "Cube", position: [1, 0, 2], scale: [2, 2, 2]})
objects | where name == "Crate" | call AddComponent("Rigidbody")
objects | where name == "Lamp" | set transform.parent = ref("GameObject#1234")
editor | call InstantiatePrefab("Assets/Prefabs/Enemy.prefab", {parent: ref("GameObject#1234"), position: [0, 0, 5]})
scenes | where path == "" | call SaveAs("Assets/Scenes/New.unity")From a terminal:
unity-mcp-cli run-tool rql-query --input '{"query": "objects | where name contains \"Enemy\" | select $ref name"}'After a write, Unity-MCP saves changed assets, the open prefab and dirty scenes. An untitled scene is reported as a not-saved warning (save it with scenes | where path == "" | call SaveAs("Assets/Scenes/X.unity")); in Play Mode, scenes are not saved. Other tools take RQL too: tests-run accepts query over the tests source, and complex tool parameters are RQL values such as ref("GameObject#12") or unity.find("Name").
Unreal Engine
Unreal-MCP runs RQL's C++ runtime inside the editor. The C++ runtime executes QueryPlans only, so the unreal-mcp-bridge sidecar parses the query text with the .NET parser, answers syntax errors itself, and renders the result. Members are the reflected properties (EditAnywhere, VisibleAnywhere, BlueprintVisible) under their C++ names: bHidden, Intensity, RelativeLocation.
Sources
| Source | Items |
|---|---|
actors | Every actor of the editor world's loaded levels, hidden ones included. |
levels | The loaded levels: Map IsPersistent IsCurrent IsVisible Actors. |
world | The editor world: Levels PersistentLevel CurrentLevel. |
selection | The actors selected in the editor. |
console | Editor log entries since startup, oldest first: Sequence Time Verbosity Category Message. |
dataTables · blueprints · widgetBlueprints · levelSequences | Assets of that kind under /Game (at most 200). |
gameplayTags | Every registered gameplay tag: Name Comment Source Parent Children …. |
settings | Project Settings and Editor Preferences sections: Container Category Section DisplayName Description Object. |
editor | Editor state (IsPlaying IsPaused Selection World CurrentLevel) and operations (below). |
Functions
| Function | Returns |
|---|---|
unreal.assets(class, path?) | Assets of a class (empty = any) under a content path (default /Game), recursive, at most 200. |
unreal.asset(path) | The loaded asset, or null. A member path may follow: unreal.asset("/Game/BP_Door").EventGraph. |
unreal.find(label) | The actor with that label, name or path. not-found otherwise. |
unreal.classes(base?, filter?) | Classes derived from base (default "Actor") whose name contains filter, at most 500. |
unreal.settings(section) | A settings object by section name, display name or class ("Maps & Modes"). |
ref("PointLight#1234") | Resolves a $ref from this editor session. |
Object model
- Every object:
Id,Name,Path(read-only).$refisType#Id, valid for the current editor session. - Actor:
Label,Location,Rotation,Scale(world transform, writable),Components,Children,Parent(writable: attach, keeps the world transform;nulldetaches),Folder,Level,HiddenInEditor. - Materials: maps
Scalars,VectorsandTextures, writable on material instances. - Data: DataTable
Rows["Sword"].Damage; gameplay tags are text (Tag == "Ability.Fire"); Blueprint graphs expose nodes and pins. - Values:
Vector(x, y, z),Rotator(pitch, yaw, roll)in degrees,LinearColor(r, g, b, a)0–1,Color0–255; write"(1, 2, 3)",[1, 2, 3]or{X: 1, Y: 2, Z: 3}; colors also"#ff8800". An asset path such as"/Game/Meshes/SM_Cube"works as an object reference. - Class defaults are read-only. Edit the class or Blueprint instead.
Calls
| On | Methods |
|---|---|
editor | SpawnActor(ClassName, Label?, Location?, Rotation?, Parent?, Scale?) · SpawnActorFromAsset(AssetPath, Label?, Location?, Rotation?, Parent?, Scale?) · OpenLevel(Path) · NewLevel(Path?, Template?) · SaveLevel(Path?) · SaveAll() · UnloadSublevel(Level) · CopyAsset(Source, Destination) · MoveAsset(Source, Destination) · DeleteAsset(Path, bForce?) · CreateFolder(Path) · RefreshAssets(Path?, bForce?) · CreateAsset(Path, ClassName) · CreateMaterialInstance(Path, Parent) · ImportAsset(File, Destination, Name?, bReplaceExisting?) · SaveAsset(Asset) · ClearConsole() · CreateDataTable(Path, RowStruct) · AddGameplayTag(Name, Comment?, Source?) · RemoveGameplayTag(Name) · RenameGameplayTag(Name, NewName) |
| Actor | Destroy() · Duplicate(Offset?) · AddComponent(ClassName, Name?) |
| Component | Destroy() (only components added to the instance) |
| Other objects | Functions marked CallInEditor with no parameters; DataTable AddRow / RemoveRow / RenameRow / DuplicateRow; user-defined struct AddField / RemoveField / RenameField / SetFieldDefault; Blueprint Compile() / AddFunction; graph, pin, widget and sequence edits (see rql-schema). |
Examples
Queries (rql-query):
actors | where Label contains "Enemy" | select $ref Label Location
actors | get Components | where $ is PointLightComponent and Intensity > 2 | select Owner.Label Intensity LightColor
actors | where Parent == null | recurse Children | select $depth Label
unreal.assets("MaterialInstanceConstant") | select Name Scalars Vectors
console | where Verbosity == "Error" | sort Sequence desc | first 5 | select Message
levels | select Map IsPersistent IsCurrent IsVisible
unreal.asset("/Game/Data/DT_Weapons") | get Rows | where Value.Damage > 10 | select Key Value.Damage
gameplayTags | where Name starts-with "Ability." | select Name Comment
unreal.asset("/Game/BP_Door").EventGraph | get Nodes | select $ref Title Pins.Name
actors | where $ is PointLight and distance(Location, unreal.find("Player").Location) < 1000 | select Label
actors | get Components | where $ is LightComponentBase | group-by $type | select key, count, avg = items.avg(Intensity)Changes (rql-mutate):
actors | where Label == "Player" | set Location = "(0, 0, 100)"
actors | get Components | where $ is PointLightComponent | set Intensity = Intensity * 2, LightColor = "#ffcc88"
actors | where Label starts-with "Enemy" | set HiddenInEditor = true
actors | where Label starts-with "Coin" | set Scale = Scale * 1.5, Location = Location + [0, 0, 50]
actors | get Components | where $ is LightComponentBase | set Intensity = (Intensity > 5000 ? 5000 : Intensity)
unreal.asset("/Game/Input/IA_Jump") | set Triggers = [{$type: "InputTriggerHold", HoldTimeThreshold: 0.5}], Modifiers = append(Modifiers, {$type: "InputModifierNegate"})
unreal.asset("/Game/Materials/MI_Red") | set Scalars["Roughness"] = 0.2, Vectors["BaseColor"] = "(1, 0, 0, 1)"
editor | call SpawnActor("PointLight", "Lamp", "(0, 0, 300)")
range(0, 150) | call editor.SpawnActor("/Engine/BasicShapes/Cube", "Cube_" + $, [($ % 15) * 150, floor($ / 15) * 150, 50])
range(0, 10) | call editor.SpawnActor({ClassName: "PointLight", Label: "Lamp_" + $, Location: [$ * 300, 0, 300]})
actors | where Label == "Crate" | call AddComponent("StaticMeshComponent", "Mesh")
actors | where Label == "Crate" | call Duplicate("(200, 0, 0)")
editor | call CreateMaterialInstance("/Game/Materials/MI_Glow", "/Game/Materials/M_Base")
editor | call SaveAll()From a terminal:
unreal-mcp-cli run-tool rql-query --input '{"query": "actors | where Label contains \"Enemy\" | select $ref Label"}'Each rql-mutate call is one editor transaction. Changes are not saved to disk: call SaveLevel, SaveAll or SaveAsset. Exceptions: project settings and gameplay-tag edits are written to their ini files at once and cannot be undone.
Godot
Godot-MCP runs the .NET runtime in editor builds. Node members are the C# properties (Position, Rotation, Visible), matched case-insensitively. Every Godot property, GDScript variables included, is also reachable by its snake_case name in props["light_energy"].
Sources
| Source | Items |
|---|---|
nodes | Every node of the edited scene, depth-first, root first (internal children excluded). |
root | The root node of the edited scene. |
selection | Nodes selected in the editor. |
scenes | Scenes open in the editor: path name active root; calls Open(), Save(). |
files | Every file the editor filesystem knows (at most 20 000): path name dir ext type uid. |
classes | Godot classes (ClassDB): name parent canInstantiate isNode isResource. |
folders | Folders of the project: path fileCount folderCount empty. |
console · gameLog | Captured editor log lines, oldest first (last 1000): sequence logType message timestamp stackTrace; gameLog: what the game run from the editor printed (Sequence LogType Message StackTrace). |
tools | Every MCP tool of this editor, hidden ones included: name title visible description. |
project · settings | Project settings (settings["section/key"], mainScene; calls such as SetSetting, AddInputAction, AddAutoload) and every setting as a row (name section value type changed). |
inputActions · autoloads · groups · layers | The input map, autoloads in load order, node and global groups, and named layers. |
editor | Editor state (isPlaying playingScene editedScene selection godotVersion projectPath) and operations (below). |
Functions
| Function | Returns |
|---|---|
godot.resources(type, folder?) | Resources of a class, subclasses included (empty type = any), at most 200, loaded lazily. |
godot.resource(path) | A res:// or uid:// resource, or null. |
godot.find(nameOrPath) | A node by unique name or by path below the scene root ("Level/Player"). not-found / ambiguous otherwise. |
godot.group(name) | The nodes of a group. |
godot.callable(target, method) | A Callable of a method on a node (path or node), a resource (res://) or Class#id, e.g. godot.callable("Player", "_on_hit"). |
ref("Node3D#1234") | Resolves a $ref (a Godot instance id). |
Object model
- Any object:
id,class(GDExtension classes too),props["snake_name"],layerNames["collision_mask"]. - Node:
name(writable, validated),path(below the root,"."= root),parent,children,childCount,index,script,groups,signals,connections,incoming. - Resource:
path,uid,Save(). - Values:
Vector2/3/4andColorprint as(…); write"(0, 1, 0)", a list or an object literal; colors also"#ff8800".Transform3Dis 12 numbers,Callableis"Player::_on_hit", RIDs are read-only. A string becomes an object:res:///uid://loads a resource, anything else is a node path or name.
Calls
| On | Methods |
|---|---|
editor | CreateNode(class, {name, parent, position, …}) · InstantiateScene(path, {name, parent, position, …}) · NewScene(path, rootClass?, rootName?) · OpenScene(path) · SaveScene(path?) · SaveAllScenes() · PlayScene(path?) · StopScene() · ClearConsole() · CreateResource(path, className?) · MoveResource(path, newPath) · DeleteResource(path, force?) · CreateFolder(path) · Reimport(files?) |
| Node | AddChild(class, name?) · InstantiateScene(path, name?) · Duplicate() · Free() · Reparent(parent, keepGlobalTransform?) · MoveChild(index) · Connect(signal, target, method, deferred?, oneShot?) · Disconnect(signal, target, method) (or Disconnect() on a row of connections) · AddToGroup(group) · RemoveFromGroup(group) |
| Any object | CallMethod(method, args?) (refused for methods of non-@tool scripts) |
| Resource | Save(), plus TileSet, Theme, ShaderMaterial and MeshLibrary edits (see rql-schema) |
Examples
Queries (rql-query):
nodes | where name contains "Enemy" | select $ref name class path
nodes | where $ is Node3D and Position.Y > 0 | select name Position
nodes | where class == "OmniLight3D" | select name props["light_energy"] props["light_color"]
root | recurse children | where childCount == 0 | select path class
godot.resources("StandardMaterial3D") | select path props["albedo_color"]
files | where ext == "tscn" | select path
console | where logType == "Error" | sort sequence desc | first 5 | select message
nodes | where name == "Player" | get incoming | select source signal method
inputActions | where builtIn == false | select name events
nodes | where $ is Node3D | group-by class | select key, count, avgY = items.avg(Position.Y)
nodes | where $ is Node3D | select name kind=($ is MeshInstance3D ? "mesh" : $ is Light3D ? "light" : "other")Changes (rql-mutate):
nodes | where name == "Player" | set Position = "(0, 1, 0)"
nodes | where class == "OmniLight3D" | set props["light_energy"] = props["light_energy"] * 2, props["light_color"] = "#ffcc88"
godot.resource("res://materials/red.tres") | set props["albedo_color"] = "(1, 0, 0, 1)"
root | call AddChild("Node3D", "Props")
range(0, 100) | call editor.CreateNode("MeshInstance3D", {name: "Cube" + $, parent: "Props", position: [($ % 10) * 2, 0, floor($ / 10) * 2], mesh: {class: "BoxMesh"}})
nodes | where name starts-with "Cube" | set Scale = Scale * 1.5
nodes | where name == "Floor" | set Mesh = {$type: "PlaneMesh", Size: "(20, 20)"}
nodes | where name == "Props" | call InstantiateScene("res://scenes/enemy.tscn")
nodes | where name == "Crate" | call Reparent(godot.find("Props"))
nodes | where name == "Enemy1" | call Connect("tree_exited", godot.find("Player"), "_on_enemy_died")
project | call AddInputAction("jump", ["Key:Space", "JoypadButton:A"])
editor | call SaveScene()From a terminal:
godot-cli run-tool rql-query --input '{"query": "nodes | where name contains \"Enemy\" | select $ref name"}'Each rql-mutate call is one undo action. A changed resource file is saved at once; edits to the scene's nodes only mark the scene unsaved, so finish with editor | call SaveScene(). Changed project settings are saved to project.godot. Complex parameters of other tools are RQL values too, e.g. godot.find("Player") for a node.
Runtimes and availability
| Where | Status |
|---|---|
| .NET | Reference runtime and text parser; NuGet com.IvanMurzak.Rql. Used by Unity-MCP and Godot-MCP, and by the Unreal-MCP sidecar for parsing and rendering. |
| TypeScript | Parser and runtime with identical plans; host function sources, the adapter kernel and modules are pending. |
| C++ | Executes QueryPlans (no text parser, by design); vendored into Unreal-MCP. |
| Engine | Status |
|---|---|
| Unity | Yes. The Unity extensions add RQL modules instead of MCP tools. |
| Unreal Engine | Yes (C++ runtime plus the .NET sidecar). |
| Godot | Yes, in editor builds. |
| Brutal Soon | Coming soon. No plugin yet. |
Extensions are RQL modules
The Unity extensions (Animation, Cinemachine, Navigation, Particle System and the rest) add no MCP tools. Each contributes an RQL module: type adapters, sources (for example navigation), functions, and an agent guide that is rendered into the unity-rql skill. You can extend the agent for your own project types the same way.
Write a type adapter and an IRqlModule in your project's Editor code — see Custom type adapters.
License
RQL is source-available under the PolyForm Shield License 1.0.0: free to use, including in commercial products, except to provide a product that competes with the licensor's products. It is not an OSI open-source license. The engine plugins themselves are Apache-2.0; the RQL code they ship keeps its PolyForm Shield license.