Skip to content

Shared types

The prompt protocol is built from a small set of reusable structures. Instead of redefining them on every prompt page, they’re collected here — each prompt’s arguments link back to the entries it uses.

Every block below is generated from the same source as the engine bindings (ts-rs for TypeScript, the manabrew-protocol crate for Rust), so it can’t drift from what’s actually on the wire.

The title/description header most modal prompts open with.

interface PromptPresentation {
title: string;
description?: string;
text?: string;
targets: Array<TargetRef>;
}

References: TargetRef

A typed reference to a player, card, or spell. The kind field says which id space id belongs to; intent and oracle optionally annotate the target.

interface TargetRef {
kind: TargetKind;
id: string;
intent?: TargetingIntent;
oracle?: string;
}

References: TargetKind , TargetingIntent

Which id space a TargetRef points into — a player, a card, or a spell on the stack.

type TargetKind = "player" | "card" | "spell";

The zones a scry-style prompt can sort cards into.

type ScryDestination =
| "libraryTop"
| "libraryBottom"
| "graveyard"
| "exile"
| "hand";

One player’s dice result.

interface DiceRollEntry {
label?: string;
playerId?: string;
naturalResults: Array<number>;
finalResults: Array<number>;
ignoredRolls: Array<number>;
highlighted: boolean;
}

One legal action offered by chooseAction: cast a spell, activate an ability, or undo a mana activation.

type AvailableAction = { id: string } & (
| { type: "cast"; cardId: string; mode: PlayCardMode; label: string }
| ({ type: "activateAbility" } & ActivatableAbilityInfo)
| { type: "undoMana"; cardId: string }
);

References: ActivatableAbilityInfo , PlayCardMode

A mana ability the player can activate while paying a cost (payManaCost).

interface ActivatableAbilityInfo {
cardId: string;
abilityIndex: number;
description: string;
isManaAbility: boolean;
isClassLevelUp?: boolean;
cost?: string;
producedMana?: Array<Mana>;
}

References: Mana

A creature that can attack, with the set of targets it may attack (chooseAttackers).

interface AttackerOptionDto {
attackerId: string;
validTargetIds: Array<string>;
mustAttack: boolean;
}

Something an attacker can be declared against — a player, planeswalker, or battle.

interface AttackTargetDto {
id: string;
label: string;
kind: AttackTargetKind;
}

References: AttackTargetKind

Which kind of thing an AttackTargetDto is.

type AttackTargetKind = "player" | "planeswalker" | "battle";

An incoming attacker and how it may be blocked (chooseBlockers).

interface BlockableAttackerDto {
attackerId: string;
validBlockerIds: Array<string>;
minBlockers: number;
maxBlockers?: number;
mustBeBlocked: boolean;
}

The Forge token definition used to distinguish tokens with the same name but different rules, such as two 2/2 white Knight tokens with different abilities. It is an opaque string on the wire; values follow Forge’s token-script names, typically colors_power_toughness_type_abilities, for example w_2_2_knight_vigilance. See Forge’s tokenscripts directory for the canonical definitions.

type TokenScript = string;