> For the complete documentation index, see [llms.txt](https://swu-forge.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://swu-forge.gitbook.io/docs/cards-and-search/searching-cards/scryfall-syntax.md).

# Scryfall Syntax Reference

Scryfall Syntax is a **prefix-style** search dialect modelled on [Scryfall](https://scryfall.com) and [SWUDB](https://swudb.com/syntax) — e.g. `c:r power>3 tr:jedi`. It's one of the two structured search dialects on SWU Forge; the other is [Forge Syntax](/docs/cards-and-search/searching-cards/search-syntax.md) (function-call style like `aspect(red) power(>3)`).

You don't have to pick a mode manually: the search box **auto-detects** which dialect you're typing. Typing `c:r` switches you to Scryfall; typing `aspect(red)` switches you to Forge. Your choice is remembered, and you can also set it explicitly from the search-mode dropdown or [Settings](/docs/account/settings.md).

## Recipes (quick start)

| Query                | Finds                                                |
| -------------------- | ---------------------------------------------------- |
| `c:r`                | Cards with the Aggression aspect                     |
| `c:rk`               | Cards with **both** Aggression and Villainy          |
| `c<=bk`              | Cards playable in a Vigilance/Villainy deck (subset) |
| `t:u power>3`        | Units with power greater than 3                      |
| `hp>power`           | Cards with more HP than power                        |
| `tr:jedi c:g`        | Command (green) Jedi                                 |
| `kw:sentinel r<=3`   | Sentinel cards costing 3 or less                     |
| `t:u c:r or t:u c:b` | Units that are red **or** blue                       |
| `(c:h or c:k) t:u`   | Units with a morality aspect (Heroism or Villainy)   |
| `a:"draw a card"`    | Cards whose text says "draw a card"                  |
| `cn:196`             | The card printed as #196                             |

## How It Works

A query is a list of **terms** separated by spaces. Every term is a required condition (**AND**). A term is one of:

* **a filter** — `prefix` + operator + value, e.g. `c:r`, `p>3`, `tr:jedi`, `hp!=power`
* **free text** — a bare word searches card names, e.g. `luke t:u`
* **a quoted phrase** — `"..."` for multi-word values, e.g. `a:"have the initiative"`
* **`or`** — see [OR & parentheses](#or--parentheses)

### Operators

`:` `=` `!=` `<` `<=` `>` `>=`. For **aspects**, `:` means "includes" (has all listed); `=` is exact (see [Aspect operators](#aspect-operators)). For **numbers**, `:` is the same as `=` (exact). Text-ish fields treat `:` and `=` the same.

## Prefix Reference

| Prefix (aliases)           | Filters                                                                                                                                                                                             | Example          |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- |
| `c` `color` `aspect`       | Aspect (see below)                                                                                                                                                                                  | `c:rk`           |
| `tr` `trait` `traits`      | Trait (multiple = AND)                                                                                                                                                                              | `tr:mandalorian` |
| `kw` `keyword`             | Keyword                                                                                                                                                                                             | `kw:ambush`      |
| `a` `ability`              | Card ability text                                                                                                                                                                                   | `a:heal`         |
| `t` `type`                 | Type — `l` b `u` e `a` (leader/base/unit/event/upgrade), or `token`                                                                                                                                 | `t:u`            |
| `arena` `l` `lane`         | Arena — `s`/`space`, `g`/`ground`                                                                                                                                                                   | `arena:g`        |
| `r` `cost` `resources`     | Resource cost                                                                                                                                                                                       | `r>=4`           |
| `power`                    | Power (also matches an upgrade/pilot's granted power; values can be negative)                                                                                                                       | `power=-2`       |
| `hp`                       | HP (also matches an upgrade/pilot's granted HP; values can be negative)                                                                                                                             | `hp<0`           |
| `powerbonus` `hpbonus`     | Upgrade/pilot power or HP bonus                                                                                                                                                                     | `powerbonus>=2`  |
| `pc` `pilotingcost`        | Piloting cost                                                                                                                                                                                       | `pc<=1`          |
| `cn` `cardnumber` `number` | Card number                                                                                                                                                                                         | `cn:196`         |
| `set`                      | Set (code or name)                                                                                                                                                                                  | `set:sor`        |
| `rarity`                   | Rarity — `c` u `r` l `s` or full name                                                                                                                                                               | `rarity:l`       |
| `ti` `title`               | Card title                                                                                                                                                                                          | `title:mentor`   |
| `u` `unique`               | Uniqueness — `u:t` / `u:f`                                                                                                                                                                          | `u:t`            |
| `vanilla`                  | No ability text                                                                                                                                                                                     | `vanilla:t`      |
| `is:` `isnot:`             | Sugar — a card type (`is:leader` `is:base` `is:unit` `is:event` `is:upgrade`), `is:token`, `is:vanilla`, `is:unique`, or a rarity (`is:common` `is:uncommon` `is:rare` `is:legendary` `is:special`) | `is:leader`      |
| `legal:`                   | `legal:premier` (Premier-legal)                                                                                                                                                                     | `legal:p`        |

Numeric fields (`cost`, `power`, `hp`) also accept **another stat name** as the value for a cross-field comparison: `cost<power`, `hp!=power`. `power` and `hp` accept negative values and also match the bonus an Upgrade or Pilot grants — `t:a power=-2` finds upgrades that give -2 power.

## Aspects

Refer to aspects by **colour letter**, name, or abbreviation:

| Aspect     | Letter       | Name / abbrev      |
| ---------- | ------------ | ------------------ |
| Aggression | `r` (red)    | `aggression`, `a`  |
| Command    | `g` (green)  | `command`, `co`    |
| Cunning    | `y` (yellow) | `cunning`, `cu`    |
| Heroism    | `w` (white)  | `heroism`, `h`     |
| Vigilance  | `b` (blue)   | `vigilance`, `vig` |
| Villainy   | `k` (black)  | `villainy`, `vil`  |

Combine **single colour letters** in one value: `c:rk` = Aggression + Villainy. (Names/abbreviations are one aspect at a time.)

### Aspect operators

| Operator    | Meaning                                                             | Example |
| ----------- | ------------------------------------------------------------------- | ------- |
| `:` or `>=` | Has **all** listed aspects (may have more)                          | `c:rk`  |
| `=`         | **Exactly** these aspects, no more, no fewer                        | `c=rk`  |
| `<=`        | **Subset** — only these aspects (colourless allowed); "playable in" | `c<=bk` |
| `<`         | Strictly fewer than the listed aspects                              | `c<rk`  |
| `>`         | Has all listed **plus at least one more**                           | `c>r`   |
| `!=`        | Does **not** have the listed aspects                                | `c!=k`  |

## OR & parentheses

By default terms combine with AND. Use **`or`** to match either side, and **parentheses** to group:

* `power>2 or hp>2` — power over 2, or HP over 2
* `c:a or c:vil r<=2` — Aggression, or Villainy costing 2 or less
* `(c:h or c:k) t:u` — Units with a morality aspect

Parentheses and `or` don't nest (matching SWUDB).

## Quotation marks

Wrap multi-word values in quotes: `a:"have the initiative"`, `title:"Aspiring to Authority"`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://swu-forge.gitbook.io/docs/cards-and-search/searching-cards/scryfall-syntax.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
