Skip to main content
Glama
grandMA2 MCP
by drohi-r

title: grandMA2 MCP description: MCP server for grandMA2 lighting consoles — 237 MCP tools via Telnet version: 1.3.1 created: 2026-04-02T00:00:00Z last_updated: 2026-10-11T20:40:46Z

grandMA2 MCP

Forked from thisis-romar/ma2-onPC-MCP (originally built by chienchuanw) — hardened and maintained by @drohi-r.

An MCP server for grandMA2 lighting consoles. Exposes 218 grandMA2 operations as Model Context Protocol tools so AI assistants (Claude Desktop, VS Code, etc.) can drive a lighting console via Telnet. Includes a built-in orchestrator, task decomposer, and long-term memory for fully autonomous lighting control.

Built for live production. Pairs with Resolume MCP, MADRIX MCP, Companion MCP, and Beyond MCP for full AI-driven show control.

Quick Start · Architecture · 218 MCP Tools · Resources · Prompts · Skills · Safety System · RAG Pipeline


Related MCP server: Eos MCP

Quick start

# 1. Install
git clone https://github.com/drohi-r/grandma2-mcp && cd grandma2-mcp
uv sync

# 2. Configure
cp .env.template .env        # then edit with your console IP

# 3. Install git hooks (auto-updates RAG index on every commit)
make install-hooks

# 4. Run
uv run python -m src.server  # starts MCP server (stdio transport)

For the local browser UI:

uv run python scripts/run_ui.py    # local-operator defaults (tier:5 scope, auth bypass)
# or, with explicit env:
GMA_HOST=192.168.20.179 GMA_PORT=30000 GMA_SCOPE=tier:5 GMA_AUTH_BYPASS=1 uv run python -m src.ui

Then open http://127.0.0.1:8092 (change with GMA_UI_PORT).

The browser UI is an operator console (zero-dependency stdlib server + vanilla JS):

  • Dashboard — showfile/version/session tiles, console users, telemetry risk-tier bars, recent agent runs, and a Divergence Watch card (snapshot a baseline, then any desk-side change — loaded show, page change, pool edits — is flagged with the exact changed vars and pool IDs; the header chip flips In sync / Diverged)

  • Playback — opens with a tile grid of every assigned executor on the page (one List Executor p.1 Thru p.199 telnet command — no per-slot scanning), with SEQ/FX badges and cue counts; clicking a tile loads detail + cue list. Manual single-slot probe and direct sequence load are still available

  • Patch — fixture types collapsed to one row each with fixture-ID ranges and universe tags; expand to compact chips; filter auto-expands matches; DMX-universe distribution card

  • Agent — goal composer with plan preview (per-step risk chips), a destructive-run confirm modal, run-trace timeline (status, duration, per-step errors), recent trace explorer, and learned-recipe list with use counts

  • Analysis — patch expectation compare + telemetry report

Important behavior notes:

  • the executor overview lists only assigned slots; empty slots are simply absent

  • direct sequence IDs are more reliable than executor-based sequence resolution

  • fixture grouping on the Patch view is parsed from live list fixture output

TIP

Semantic search: Add GITHUB_MODELS_TOKEN=ghp_... to .env, then run uv run python scripts/rag_ingest.py --provider github once to rebuild the index with real embeddings. The search_codebase MCP tool will automatically use semantic ranking when the token is present.

Architecture

graph TD
    H["🤖 Agent Core Layer<br/><code>src/server_orchestration_tools.py</code><br/>34 tools (IDs 110–144, excluding 130) · orchestrator · skills"] --> A
    A["🎭 MCP Server Layer<br/><code>src/server.py</code> + <code>src/mcp_tools/</code><br/>203 server tools · safety gate"] --> B
    B["🧭 Navigation Layer<br/><code>src/navigation.py</code><br/>cd · list · scan · set_property"] --> C
    C["🔧 Command Builders<br/><code>src/commands/</code><br/>198 pure functions → strings"] --> D
    D["📡 Telnet Client<br/><code>src/telnet_client.py</code><br/>async · auth · injection prevention"]

    E["📖 Prompt Parser<br/><code>src/prompt_parser.py</code><br/>prompt detection · list parsing"] -.-> B
    F["🛡️ Vocabulary & Safety<br/><code>src/vocab.py</code><br/>157 keywords · risk tiers"] -.-> A
    G["🔍 RAG Pipeline<br/><code>rag/</code><br/>crawl → chunk → embed → query"] -.-> A
    I["🧠 Memory & Planning<br/><code>src/agent_memory.py · src/orchestrator.py</code><br/>WorkingMemory · LTM · TaskDecomposer"] -.-> H
    J["📊 OpenSpace<br/><code>src/telemetry.py · src/skill.py · src/skill_improver.py</code><br/>invocation recorder · skill registry · improvement loop"] -.-> H

    style H fill:#1a1a2e,stroke:#e94560,color:#fff
    style A fill:#1a1a2e,stroke:#e94560,color:#fff
    style B fill:#1a1a2e,stroke:#0f3460,color:#fff
    style C fill:#1a1a2e,stroke:#16213e,color:#fff
    style D fill:#1a1a2e,stroke:#533483,color:#fff
    style E fill:#0f3460,stroke:#0f3460,color:#fff
    style F fill:#0f3460,stroke:#0f3460,color:#fff
    style G fill:#0f3460,stroke:#0f3460,color:#fff
    style I fill:#0f3460,stroke:#0f3460,color:#fff
    style J fill:#0f3460,stroke:#0f3460,color:#fff

All network I/O is isolated in telnet_client.py. Command builders are pure functions that return strings. The navigation layer orchestrates cd/list workflows with parsed telnet feedback.

Agent Harness vs. Agent Core

grandMA2 MCP is a layered hybrid — the boundary is explicit in the code:

Layer

What it is

Key files

Bottom 203 server tools

Agent Harness — exposes the core MCP tool surface to an external AI; the reasoning loop lives in Claude Desktop, VS Code, etc.

src/server.py, src/mcp_tools/

Top 34 orchestration tools

Embedded Agent Core — orchestrator, task decomposer, long-term memory, skill registry

src/server_orchestration_tools.py, src/orchestrator.py

The orchestrator accepts a sub_agent_fn injection point. Without it, tool calls run in-process. Wire in a Claude API client and grandMA2 MCP becomes a fully autonomous agent that plans, executes, remembers, and improves itself.

Module Overview

Module

Role

src/server.py

FastMCP instance, reply contract, safety gate, env config

src/mcp_tools/

26 domain modules holding the 203 server tools, resources and prompts

src/server_orchestration_tools.py

34 agentic tools (IDs 110–144, excluding 130) registered onto FastMCP

src/orchestrator.py

Multi-agent task runner: hydration, risk-tier isolation, LTM; _showfile_guard(), check_showfile() for dynamic show change detection

src/task_decomposer.py

Natural-language goal → ordered SubTask plan (rule-based)

src/agent_memory.py

WorkingMemory (ephemeral) + LongTermMemory (SQLite session log) + showfile baseline tracking (baseline_showfile, showfile_changed())

src/console_state.py

ConsoleStateSnapshot: hydrates 19 show-memory gaps; parse_showfile_from_listvar()

src/pool_name_index.py

In-memory pool name/ID registry — zero-cost object resolution

src/rights.py

MA2 native rights enforcement + telnet feedback classification

src/auth.py

OAuth 2.1 scope enforcement (@require_scope, @require_ma2_right)

src/credentials.py

OAuth tier → console user credential resolver

src/session_manager.py

Per-operator Telnet session pool (LRU, keepalive, auto-reconnect)

src/navigation.py

cd + list + scan orchestration

src/prompt_parser.py

Parse console prompts and list tabular output

src/vocab.py

157 keywords, RiskTier, FunctionalDomain, safety classification

src/commands/

198 exported command-builder functions, grouped by keyword type

src/commands/busking.py

6 busking/performance builders: effect assign, rate/speed, page release, fader zero

src/categorization/

ML tool categorization: K-Means clustering + auto-labeling

src/telemetry.py

Per-tool invocation recorder: tool_invocations table, latency, risk tier

src/skill.py

Skill dataclass + SkillRegistry: versioned playbooks with lineage + filesystem skill fallback (_load_filesystem_skill, _list_filesystem_skills)

src/skill_improver.py

SkillImprover: repair suggestions + promotion candidates (read-only)

src/tools.py

Global GMA2 telnet client accessor — get_client() used by all tools

Configuration

Create a .env file (see .env.template):

# grandMA2 Console
GMA_HOST=192.168.1.100     # grandMA2 console IP (required)
GMA_USER=administrator     # default: administrator
GMA_PASSWORD=admin         # default: admin
GMA_PORT=30000             # default: 30000 (30001 = read-only)
GMA_SAFETY_LEVEL=standard  # standard (default), admin, or read-only
GMA_TOOL_PROFILE=full      # core (28 tools), standard (104) or full (237, default)
GMA_ELICIT_CONFIRM=1       # 0 = never open confirm dialogs for destructive calls
GMA_MAX_REPLY_CHARS=20000  # cap on raw console text returned per reply
LOG_LEVEL=INFO             # default: INFO

# RAG Pipeline (optional)
GITHUB_MODELS_TOKEN=                          # GitHub PAT with models:read scope
RAG_EMBED_MODEL=openai/text-embedding-3-small # embedding model
RAG_EMBED_DIMENSIONS=1536                     # vector dimensions
NOTE

Get a GitHub PAT with themodels:read scope at github.com/settings/tokens.

Level

Behavior

read-only

Only SAFE_READ commands allowed (list, info, cd)

standard

SAFE_READ + SAFE_WRITE allowed; DESTRUCTIVE requires confirm_destructive=True

admin

All commands allowed without confirmation

GMA_TOOL_PROFILE trims what MCP clients see when they load every tool schema up front (about 40k tokens for all 237). run_agent_goal can still use every tool. See doc/tool-surface-tiers.md.

MCP Tools

The server exposes 237 tools to MCP clients, grouped into 15 categories plus an agentic orchestration layer:

Tool

Description

navigate_console

Navigate the console object tree via ChangeDest (cd)

get_console_location

Query the current console destination without navigating

list_console_destination

List objects at the current destination with parsed entries

scan_console_indexes

Batch scan numeric indexes at any tree level

cd /            → go to root
cd ..           → go up one level
cd Group.1      → navigate to Group 1 (dot notation)
cd 5            → navigate by element index
cd "MySeq"      → navigate by name
list            → enumerate objects at current destination

Dot notation: MA2 uses [object-type].[object-id] for object references (e.g., Group.1, Preset.4.1, Sequence.3).

Tool

Description

set_intensity

Set dimmer level on fixtures, groups, or channels

set_attribute

Set attribute values (Pan, Tilt, Zoom, etc.) on fixtures/groups

apply_preset

Apply a stored preset (color, position, gobo, beam, etc.)

clear_programmer

Clear programmer state (all, selection, active, or sequential)

park_fixture

Park a fixture/channel at its current or a specified value

unpark_fixture

Release a park lock on a fixture/channel

fix_locate_fixture

Fix (park) or Locate selected/specified fixtures at their defaults

Tool

Description

modify_selection

Select, deselect, or toggle fixtures in the programmer

adjust_value_relative

Adjust programmer values relatively (+ or –)

manipulate_selection

Invert or Align the current fixture selection / programmer values

select_fixtures_by_group

Select all fixtures in a named group

select_executor

Set the active executor for subsequent operations (single-selection only; use deselect=True to clear)

select_feature

Set active Feature context (updates $PRESET/$FEATURE/$ATTRIBUTE)

select_preset_type

Activate a PresetType context (PresetType 1–9 or by name)

if_filter

Apply an IfOutput / IfActive filter to limit programmer scope

Tool

Description

execute_sequence

Legacy sequence playback: go, pause, or goto cue

playback_action

Full playback: go, go_back, goto, fast_forward, fast_back, def_go, def_go_back, def_pause

control_executor

Control an executor (go, pause, stop, flash, etc.)

load_cue

Pre-load the next or previous cue on an executor without firing it

get_executor_status

Query status of an executor (current cue, level, state)

set_executor_level

Set the fader level on an executor

navigate_page

Navigate to a specific page or page +/–

release_executor

Release (deactivate) an executor

blackout_toggle

Toggle grandmaster blackout on/off

Parameters

Parameter

Type

Description

action

str

One of the actions below

object_type

str | None

Object type for go/go_back (e.g. "executor", "sequence")

object_id

int | list[int] | None

ID or list of IDs — list produces N + M + … syntax

cue_id

int | float | None

Required for "goto"

end

int | None

End of range for go/go_back (builds thru N)

cue_mode

str | None

"normal", "assert", "xassert", or "release"

executor

int | list[int] | None

Executor ID(s) for goto/fast_forward/fast_back — list produces N + M + …

sequence

int | None

Sequence ID for goto/fast_forward/fast_back

Actions

Action

Command sent

Notes

"go"

go [object_type] [id]

Fires next cue; object_id accepts a list

"go_back"

goback [object_type] [id]

Fires previous cue; object_id accepts a list

"goto"

goto cue N [executor/sequence]

Pre-flight validates cue exists; returns blocked=True on Error #72

"fast_forward"

>>> [executor N]

executor accepts a list

"fast_back"

<<< [executor N]

executor accepts a list

"def_go"

defgoforward

Fires on $SELECTEDEXEC; reads state before firing

"def_go_back" / "def_goback"

defgoback

Same — def_goback is an alias

"def_pause"

defgopause

Same

Response fields

All actions return command_sent and raw_response.

def_go, def_go_back, and def_pause additionally return:

Field

Value

selected_executor

Value of $SELECTEDEXEC read before the command was sent (null if unavailable)

selected_cue_before

Value of $SELECTEDEXECCUE read before the command (null if unavailable)

goto additionally returns cue_exists, cue_probe_response, and optionally executor_probe_response.

Examples

# Fire next cue on executors 1, 2, and 3 simultaneously
playback_action(action="go", object_type="executor", object_id=[1, 2, 3])
# → go executor 1 + 2 + 3

# Fast-forward executors 2 and 4
playback_action(action="fast_forward", executor=[2, 4])
# → >>> executor 2 + 4

# Go back on the selected executor — response tells you which one fired
playback_action(action="def_go_back")
# → {"command_sent": "defgoback", "selected_executor": "5", "selected_cue_before": "3"}

Single-selection only. MA2 telnet select executor N accepts exactly one executor number. There is no list syntax — pass a single executor_id integer.

Parameters

Parameter

Type

Default

Description

executor_id

int

required

Executor number (1–999)

page

int | None

None

Page number — produces select executor page.id (e.g. page=2, executor_id=5 → select executor 2.5)

deselect

bool

False

If True, sends bare select to clear the current selection (unverified on grandMA2 telnet — inspect raw_response)

Response fields

Field

Always present

Description

command_sent

✓

The exact command sent

raw_response

✓

Raw telnet reply

confirmed_selected_exec

✓

Value of $SELECTEDEXEC read after the command (null if unavailable)

risk_tier

✓

"SAFE_WRITE"

warning

if mismatch

Present when confirmed_selected_exec doesn't match the requested executor_id

note

if deselect

Present when deselect=True — warns that bare select behaviour is unverified

Page-qualified addressing

When page is supplied, MA2 stores $SELECTEDEXEC as the executor number only (not the page-qualified form). The confirmation check compares against executor_id alone — no spurious warning.

Examples

# Select executor 5 and confirm
select_executor(executor_id=5)
# → {"command_sent": "select executor 5", "confirmed_selected_exec": "5"}

# Select executor 5 on page 2
select_executor(executor_id=5, page=2)
# → {"command_sent": "select executor 2.5", "confirmed_selected_exec": "5"}

# Clear the current selection
select_executor(executor_id=1, deselect=True)
# → {"command_sent": "select", "note": "Bare 'select' sent … unverified …"}

Tool

Description

create_fixture_group

Select a range of fixtures and save as a named group

store_current_cue

Store programmer state into a cue

store_new_preset

Store programmer state as a new preset

store_object

Store generic objects — macros, effects, worlds, etc.

store_cue_with_timing

Store a cue with explicit fade/delay timing

update_cue_data

Update an existing cue with current programmer values

set_cue_timing

Edit fade, delay, or trigger timing on an existing cue

set_sequence_property

Set a property on a sequence (e.g. looping, autoprepare)

assign_cue_trigger

Assign a trigger type (Go, Follow, Time) to a cue

block_unblock_cue

Block or Unblock a cue to freeze/restore its tracked values

clone_object

Clone (duplicate with data) one or more objects to new IDs

remove_from_programmer

Remove specific fixtures or channels from the programmer

run_macro

Execute a stored macro by ID

WARNING

Store tools areDESTRUCTIVE — they require confirm_destructive=True.

Tool

Description

control_timecode

Start, stop, or jump a timecode show

control_timer

Start, stop, or reset a timer

store_timecode_event

Store an event into a timecode show at the current time

Tool

Description

assign_object

Assign objects, functions, fades, or layout positions

assign_executor_property

Assign any of 22 settable options on an executor (width, priority, autostart, etc.) — page-qualified

get_executor_state

Read all 32 fields of one executor via List Executor page.id (SAFE_READ)

scan_page_executor_layout

Map executor slot occupancy on a page — required pre-flight before width expansion (SAFE_READ)

discover_fixture_type_attributes

Discover fixture type attribute names via EditSetup tree navigation (SAFE_READ)

label_or_appearance

Label or set visual appearance of objects

edit_object

Edit, cut, or paste objects

cut_paste_object

Cut an object to clipboard, or paste clipboard content at a location

remove_content

Remove content from objects — fixtures, effects, preset types

save_recall_view

Save or recall a screen view configuration

set_executor_priority

Set playback priority on an executor (super/high/normal/low/htp/swap)

set_node_property

Set a property on any node via dot-separated tree path (DESTRUCTIVE)

Tool

Description

save_show

Save the current show file to disk

list_shows

List available show files on the console

load_show

Load a show file by name

new_show

Create a new empty show

delete_show

Delete a show file from disk

export_objects

Export show objects (groups, presets, macros, etc.) to a file

import_objects

Import objects from a file into the show

CAUTION

new_show without preserve_connectivity=True disables Telnet, severing the MCP connection.

Tool

Description

list_fixture_types

List fixture types loaded in the show

list_layers

List fixture layers in the patch

list_universes

List configured DMX universes

list_library

Browse the MA2 fixture library

list_fixtures

List fixtures currently patched in the show

browse_patch_schedule

Browse the DMX patch schedule

patch_fixture

Patch a fixture to a DMX universe and address

unpatch_fixture

Remove a fixture's DMX patch assignment

set_fixture_type_property

Set a property on a fixture type

manage_matricks

Manage MAtricks (fixture matrix) objects

create_matricks_library

Generate combinatorial MAtricks pool with 25-color coding

store_matricks_preset

Combined set + store + label MAtricks preset workflow

create_filter_library

Generate color-coded Filter library with V/VT/E variants

import_fixture_type

Import a fixture type from the MA2 library

import_fixture_layer

Import a fixture layer XML file into the show patch

generate_fixture_layer_xml

Generate a grandMA2 fixture layer XML file for import

# 1. Generate the XML file
generate_fixture_layer_xml(
    filename="my_dimmers",
    layer_name="Dimmers",
    layer_index=1,
    fixtures=[
        {"fixture_id": 1, "name": "Dim 1", "fixture_type_no": 2,
         "fixture_type_name": "2 Dimmer 00", "dmx_address": 1, "num_channels": 1},
    ],
    showfile="myshow",
)

# 2. Import the fixture type from library
import_fixture_type(
    manufacturer="Martin",
    fixture="Mac700Profile_Extended",
    mode="Extended",
    confirm_destructive=True,
)

# 3. Import the layer
import_fixture_layer(filename="my_dimmers", layer_index=1, confirm_destructive=True)

Generates every combination of Wings × Groups × Blocks × Interleave (5⁴ = 625 items) with a 25-color scheme embedded directly in the XML:

Dimension

Controls

Values

Wings

Hue

Red (0°) · Yellow-Green (72°) · Cyan (144°) · Blue (216°) · Magenta (288°)

Groups

Brightness

100% · 80% · 60% · 45% · 30%

Blocks

—

0–4

Interleave

—

0–4

Colors use <Appearance Color="RRGGBB" /> in the XML — import is instant, no telnet loop required.

# Full library (625 items)
python -m scripts.create_matricks_library --max-value 4

# Quick test (16 items)
python -m scripts.create_matricks_library --max-value 1

# XML only (no telnet import)
python -m scripts.create_matricks_library --xml-only

# Re-apply colors via telnet (if needed)
python -m scripts.create_matricks_library --color-only

Tool

Description

get_object_info

Query info on any object (fixture, group, sequence, etc.)

query_object_list

List cues, groups, presets, attributes, or messages

get_variable

Get the current value of a console variable

list_system_variables

List all 26 built-in system variables ($TIME, $SHOWFILE, etc.)

list_sequence_cues

List all cues in a sequence with timing and labels

discover_object_names

Discover named objects in a pool via the cd tree

check_pool_availability

Check which slots are occupied and free in an object pool

browse_preset_type

Browse Feature/Attribute/SubAttribute tree for a PresetType

list_preset_pool

List presets in the Global preset pool by type

browse_effect_library

Browse the grandMA2 effect library

browse_macro_library

Browse the grandMA2 macro library

browse_plugin_library

Browse the grandMA2 plugin library

highlight_fixtures

Toggle highlight mode for selected fixtures

list_undo_history

List recent undo history entries

discover_filter_attributes

Discover show-specific filter attributes from patched fixtures

Tool

Description

send_raw_command

Send any MA command directly (safety-gated; every ;-part is classified)

run_command_batch

Run a list or file of commands on one held connection; stops at the first console error or pop-up

answer_console_popup

Answer a pop-up a reply reported as pending_popup (non-Cancel answers need confirmation)

disconnect_console

Close this server's Telnet session to free the console; the next call reconnects

copy_or_move_object

Copy or move objects between slots (with merge/overwrite)

delete_object

Delete any object by type and ID

manage_variable

Set or add to console variables (global or user-scoped)

undo_last_action

Undo the last console action

toggle_console_mode

Toggle console modes: blind, highlight, freeze, solo

list_fader_modules

List connected fader modules and their configuration

list_update_history

List programming update history

Tool

Description

list_console_users

List all user profiles configured on the console

create_console_user

Create a new user profile with name and password

delete_user

Delete a user profile

inspect_sessions

Inspect active Telnet sessions and connected operators

assign_world_to_user_profile

Assign a world (visibility scope) to a user profile

NOTE

RequiresGMA_SCOPE=gma2:user:manage (Admin tier). Bootstrap 5 default user accounts with python scripts/bootstrap_console_users.py.

Tool

Description

list_tool_categories

Browse auto-discovered tool categories via K-Means clustering

recluster_tools

Re-run the full ML pipeline (extract → embed → cluster → label)

get_similar_tools

Find the most similar tools by Euclidean distance in feature space

suggest_tool_for_task

Suggest tools for a natural-language task description

Tool

Description

search_codebase

Semantic search over the indexed codebase and MA2 docs

These tools form the agentic layer (src/server_orchestration_tools.py). They enable multi-step task execution with memory, risk-tier isolation, and zero-telnet state queries via a ConsoleStateSnapshot cache that closes 19 show-memory gaps.

For the higher-level agent harness in src/server.py, prefer plan_agent_goal to preview and run_agent_goal to execute. Use decompose_task / run_task when you specifically want the lower-level rule-based orchestration surface in src/server_orchestration_tools.py.

Task Orchestration (Tools 110–118)

Tool

Description

decompose_task

Break a lighting goal into an ordered multi-agent plan (review before execute)

run_task

Execute a full task with risk-tier isolation, memory, and state hydration

list_agent_sessions

List recent task sessions from long-term memory

recall_agent_session

Restore WorkingMemory snapshot from a past session

agent_token_report

Report token consumption across agent sessions

register_decomposition_rule

Register a custom task-decomposition rule at runtime

resolve_object_ref

Resolve a pool object name/ID to a quoted MA2 token (zero telnet)

list_pool_names

List all names and IDs for a pool type from the in-memory index

hydrate_console_state

Trigger a fresh ConsoleStateSnapshot hydration

Console State Queries (Tools 119–129)

Read from the cached snapshot — no telnet round-trips required.

Tool

Description

get_console_state

Snapshot summary, age, and staleness warning

get_park_ledger

All currently parked fixtures

get_filter_state

Active filter ID and V/VT/E flag settings

get_world_state

Active world and visibility scope

get_matricks_state

Write-tracked MAtricks state (interleave, blocks, wings, etc.)

get_programmer_selection

$SELECTEDFIXTURESCOUNT, $SELECTEDEXEC, $SELECTEDEXECCUE

hydrate_sequences

Deep-hydrate specific sequence cues and parts

get_sequence_memory

Sequence properties and CueRecords from the snapshot

assert_selection_count

Validate fixture selection count against an expected value

assert_preset_exists

Pre-flight check: verify a preset slot is occupied

get_executor_detail

Full ExecutorState for a given executor ID

Orchestration Safety & Diagnostics (Tools 131–137)

Tool

Description

diff_console_state

Compare current snapshot against a caller-supplied baseline; returns changed fields

get_showfile_info

Return showfile name, version, host status, and active user from snapshot (zero telnet)

watch_system_var

Poll a grandMA2 system variable until it changes or a timeout is reached

confirm_destructive_steps

Decompose a goal and return only the DESTRUCTIVE steps for human review

abort_task

Mark a running session as aborted and return completed/failed step summary

retry_failed_steps

Reload a past session from LTM and re-run the original goal

assert_fixture_exists

Two-tier fixture patch validation (snapshot index → live telnet fallback)

OpenSpace Layer — Telemetry, Skills & Improvement (Tool IDs 110–144, excluding 130)

Tool

Scope

Description

get_tool_metrics

DISCOVER

Latency + error-rate stats for any tool over N days

list_skills

DISCOVER

Search the skill registry by name, description, or context

get_skill

DISCOVER

Full detail + lineage chain for a single skill

promote_session_to_skill

PROGRAMMER_WRITE

Manually promote a completed session to a named, versioned skill

get_improvement_suggestions

DISCOVER

Repair suggestions (failing tools) + promotion candidates (successful sessions)

approve_skill

SYSTEM_ADMIN

Human-gate: set approved=True on a DESTRUCTIVE-scope skill before agents may use it

assert_showfile_unchanged

DISCOVER

Verify open show matches hydration baseline — live ListVar vs cached snapshot

Compliance, Patch Validation & Cross-Venue Tools

Tool

Scope

Description

detect_dmx_address_conflicts

DISCOVER

Scan all universes for overlapping fixture DMX address assignments

get_telemetry_report

DISCOVER

Export tool invocation telemetry as JSON or markdown audit log

generate_compliance_report

DISCOVER

SB 132 / safety-audit compliance report from session telemetry

validate_preset_references

DISCOVER

Scan cue list for references to deleted or missing preset pool entries

list_macro_jump_targets

DISCOVER

Parse macro lines and extract all jump targets for index-shift planning

check_pool_slot_availability

DISCOVER

Pre-flight: which pool slots are empty vs. occupied in a range

remap_fixture_ids

PROGRAMMER_WRITE

Remap fixture references from one ID to another in groups after PSR import

NOTE

Callhydrate_console_state before using state-query tools. The snapshot caches values that have no direct telnet readback (MAtricks state, park ledger, filter VTE flags, etc.). Check freshness with get_console_state.

Tool

Description

assign_temp_fader

Set the temp fader level on the currently selected executor

assign_effect_to_executor

Bind an effect template to an executor slot (DESTRUCTIVE — requires confirm_destructive=True)

modulate_effect

Set rate (EffectRate) or speed (EffectSpeed) on active effects

clear_effects_on_page

Release all effect executors on a page range

normalize_page_faders

Set all faders on a page to 0 without releasing

classify_show_mode

Inspect executor assignments and classify show as busking, sequence, hybrid, or empty

MCP Resources

Fourteen read-only resources exposable to any MCP client. Use them for zero-telnet context before calling tools.

URI

Description

ma2://console/activity

Live: recent console-changing tool calls; subscribe to get an update after every change

ma2://docs/rights-matrix

OAuth scope → MA2Right mapping matrix (JSON)

ma2://docs/vocab-summary

All 157 keywords with RiskTier and category (JSON)

ma2://docs/tool-taxonomy

ML-clustered tool taxonomy — all tools clustered by category (JSON)

ma2://docs/responsibility-map

Module responsibility map for architectural decisions (Markdown)

ma2://docs/tool-surface-tiers

Tier A/B/C classification for every tool (Markdown)

ma2://docs/volunteer-guide

Plain-language volunteer operator guide: three-tier access model + Sunday preflight

ma2://docs/sb132-compliance

SB 132 / CA Film Tax Credit safety documentation mapped to telemetry fields

ma2://docs/rdm-workflow

RDM discovery, autopatch, and device info best practices

ma2://docs/lua-scripting

grandMA2 Lua 5.2 scripting reference: gma.* namespace + common patterns

ma2://skills/{skill_id}

Skill injection payload by ID — returns formatted user message ready for agent injection

ma2://busking/patterns

Best-practice busking patterns: fader model, song macro protocol, live recovery

ma2://busking/effect-design

Effect-to-executor assignment patterns, rate vs speed, MAtricks layering

ma2://busking/color-design

HSB palette strategy, preset numbering, monochromatic constraint, color lock

All resources are read-only — no console side-effects.

MCP Prompts

Ten workflow prompts that orchestrate tools into guided multi-step procedures.

Prompt

Args

Description

preflight_destructive_change

operation, target, reason

Safety pre-flight checklist before any DESTRUCTIVE tool call — checks rights, target existence, blind mode, and executor state

inspect_console

focus

Guided read-only console state inspection — full, playback, fixtures, show, or rights

plan_cue_store

sequence_id, cue_number, fixture_selection, preset_or_values

Plan a cue store operation with pre-flight and verification steps — does not execute

diagnose_playback_failure

executor_id, symptom

Structured playback failure diagnosis — returns fault_class, root_cause, recommended_actions

load_show_safely

show_name

Safe show loading checklist — prevents accidental Telnet disconnection via missing /globalsettings

bootstrap_rights_users

(none)

Guided provisioning of the six-tier MA2 rights user accounts

volunteer_sunday_preflight

show_name, campus_name

SAFE_READ preflight for volunteer operators — GREEN/AMBER/RED show verification before service

generate_busking_template

target_page, fixture_strategy

Build a complete busking template from current patch — groups, presets, effects, executor layout

pre_show_health_check

sequence_ids, strict

Full show health audit — showfile, presets, executors, cues, parks, and DMX with scored findings

adapt_show_to_venue

source_show_description, new_venue_notes

Cross-venue show adaptation — patch comparison, group remapping, preset verification

Agent Skills

Forty-five instruction modules in .claude/skills/ are injected as user messages into agent conversations. They teach agents domain-specific workflows without embedding knowledge in tool docstrings.

Skill

Description

ma2-command-rules

MA2 command construction, object resolution, quoting rules, and safety escalation

telnet-feedback-triage

Classify and summarise grandMA2 Telnet feedback using the FeedbackClass enum

feedback-investigator

Worker playbook: classify and investigate Telnet feedback failures

cue-list-auditor

Worker playbook: audit cue list gaps, labels, timing, and health

operator-recovery-runbook

On-site incident response for stuck playback, contaminated programmer, wrong world/filter, and similar show emergencies

busking-lighting-performance

Live busking — fader-per-effect model, executor layout, effect layering, live recovery

song-macro-page-design

Song macro pages — first-button protocol, executor column layout, jump target safety

constrained-color-design

Monochromatic HSB palette design — preset numbering, color lock, song-to-palette mapping

preset-library-architect

Build full dimmer/position/color/gobo preset pools from raw attribute values

preset-impact-manager

Assess preset updates or deletions safely by tracing downstream cue and showfile references

patch-and-group-builder

Patch fixtures, build groups by type/position, and verify selection counts

festival-stage-setup

End-to-end one-off festival workflow from patched rig to busking-ready showfile

fixture-swap-surgeon

Analyze fixture substitutions and plan compatible swap + migration steps

chaser-builder

Step-based chasers, running lights via MAtricks, strobes — speed/rate/direction control

cue-tracking-and-timing

Tracking vs non-tracking, Block/Unblock, MIB, timing layers, trigger types, Update vs Store

tracking-debugger

Diagnose tracking leaks, unexpected blocks, and cue inheritance problems in sequences

cue-to-cue-rehearsal

Guided cue-by-cue walkthrough with state summaries and cue diffs during rehearsal

executor-configuration

Executor priority, trigger types, fader functions, speed masters, protect options

show-management-and-psr

Save/Load/New show (connectivity preservation), PSR workflow, Export/Import XML

macro-advanced

SetVar/SetUserVar, conditionals, CmdDelay, jump targets, XML authoring, Store Group timing

macro-linter-and-refactorer

Inspect macros for unsafe patterns, broken jumps, and cleanup opportunities

clone-and-data-transfer

Clone fixture with /selective, copy/move pool objects, cue-range copy, cross-show PSR

effect-programmer

Build effects from scratch, layer rate/speed/phase, assign to executors

world-filter-designer

Create worlds, assign fixtures, configure filter objects, control visibility

timecode-show-programmer

Build timecode shows, assign events to cues, enable/disable tracks

color-preset-creator

Store universal color presets from RGB values — builds the preset pool

color-palette-sequence-builder

Build a cue sequence where each cue references a universal color preset

auto-layout-color-picker

Preflight and run the installed auto-layout color picker plugin safely — groups, ranges, images, layout, and post-run verification

hue-palette-creator

Store 96 universal hue presets (4.101–4.196) using the HSB color model

hue-sequence-builder

Build a 16-cue sequence from an adjacent hue pair — 8 saturation variants per hue

sequence-executor-assigner

Assign a sequence to a free executor so it appears as a playback fader

rdm-workflow

RDM discovery → device info → autopatch workflow via MCP

lua-and-plugins

Lua 5.2 scripting with gma.* namespace, plugin invocation, and reload lifecycle

troubleshoot-no-output

Systematic no-output diagnostic from Grand Master and worlds down to DMX and fixture-level faults

companion-integration

Build Bitfocus Companion button pages that mirror the MA2 executor layout

showkontrol-bpm-sync

Sync CDJ tempo from ShowKontrol into MA2 speed masters for live BPM-locked effects

psr-show-migration

PSR with pre-flight slot check, fixture ID verification, and post-import diff

compliance-documentation

Generate SB 132 / insurance audit reports from session telemetry — SAFE_READ only

volunteer-operations

Three-tier access model, Sunday morning preflight, and incident response for non-programmers

view-and-layout-designer

Custom console views, executor button placement, image assignment, sheet recall

show-health-check

Pre-show audit — showfile, presets, executors, cues, parks, DMX. Returns GREEN/AMBER/RED

busking-template-generator

Build a complete busking template from any patched rig — groups, presets, effects, executor page

cross-venue-adaptation

Adapt show to a new venue rig — patch comparison, group remapping, preset scope verification

training-mode

Annotated SAFE_READ console tour for students, church volunteers, and IATSE training programs

remote-monitoring

Continuous SAFE_READ polling — show change detection, alert conditions, broadcast and architectural protocols

Skills are loaded on demand via ma2://skills/{skill_id} resource or injected by the orchestrator. Use list_skills / get_skill tools to browse and inspect them at runtime.

Client Setup

Claude Desktop

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "gma2": {
      "command": "uv",
      "args": ["--directory", "/path/to/grandma2-mcp", "run", "python", "-m", "src.server"],
      "env": {
        "GMA_HOST": "192.168.1.100",
        "GMA_USER": "administrator",
        "GMA_PASSWORD": "admin"
      }
    },
    "time": {
      "command": "uvx",
      "args": ["mcp-server-time"]
    }
  }
}

The time server provides accurate ISO 8601 timestamps for markdown front matter — required by .claude/rules/markdown-frontmatter.md. It is also registered automatically for Claude Code CLI via .mcp.json and for VS Code via vscode-mcp-provider/.

VS Code

The vscode-mcp-provider/ directory contains a VS Code extension that registers the grandMA2 MCP server for AI assistant discovery.

cd vscode-mcp-provider
npm install && npm run compile
# Then install in VS Code (F5 to debug, or package with vsce)

See vscode-mcp-provider/README.md for full details.

Codex

Create a codex.json MCP config file:

{
  "mcpServers": {
    "gma2": {
      "command": "uv",
      "args": ["--directory", "/path/to/grandma2-mcp", "run", "python", "-m", "src.server"],
      "env": {
        "GMA_HOST": "192.168.1.100",
        "GMA_USER": "administrator",
        "GMA_PASSWORD": "admin"
      }
    }
  }
}

Then run Codex with:

codex --mcp-config codex.json

Safety System

grandMA2 MCP enforces a 3-layer model where effective permissions are the intersection of all three — no single layer can expand privileges:

scope ∩ policy ∩ ma2_rights = FINAL AUTHORITY

Layer 1 — OAuth Identity (src/auth.py)

Six scope tiers map to console users created by scripts/bootstrap_console_users.py:

GMA_SCOPE

Console user

MA2 Rights

Can do

tier:0

guest

None (0)

Read-only — list, info, cd

tier:1

operator

Playback (1)

Go, Flash, Off, timecode

tier:2

presets_editor

Presets (2)

Set attributes, apply/store presets

tier:3

programmer

Program (3)

Store cues, groups, sequences, macros

tier:4

tech_director

Setup (4)

Patch, fixture import, console setup

tier:5

administrator

Admin (5)

User management, show load/delete

Layer 2 — Policy Gate (src/rights.py)

Every tool is annotated with @require_ma2_right(MA2Right.X) which enforces the OAuth scope requirement before any Telnet command is sent. The check_permission() utility provides a unified gate combining scope and rights checks:

result = check_permission("store_current_cue", granted_scopes, user_right)
# scope ∩ MA2Right — both must pass
if not result.allowed:
    return result.as_block_response()

Rights are enforced in code via @require_ma2_right; doc/ma2-rights-matrix.json documents the rights model.

Layer 3 — MA2 Native Rights (console enforcement)

The Telnet session runs as a console user whose native rights are enforced by grandMA2 itself. Commands beyond that user's rights level are rejected with Error #72 — an irrevocable floor that exists regardless of what Layer 1 or 2 permit.

Bootstrap required: On a fresh show, run python scripts/bootstrap_console_users.py as Administrator to create the 5 intermediate users. Only Administrator and Guest exist natively.

Risk Tiers (server-side gate)

In addition to the 3-layer model, every keyword is classified into one of three risk tiers enforced by _handle_errors:

Tier

Description

Examples

SAFE_READ

Read-only queries

Info, List, CmdHelp, ChangeDest

SAFE_WRITE

Reversible state changes

Go, At, Clear, Park, SelFix

DESTRUCTIVE

Data mutation or loss

Delete, Store, Copy, Move, Shutdown

DESTRUCTIVE tools require confirm_destructive=True in addition to OAuth scope. When the MCP client supports elicitation, a destructive call made without it opens a confirm dialog instead of just failing; only an explicit accept runs it (disable with GMA_ELICIT_CONFIRM=0). run_agent_goal without auto_confirm asks the same way per destructive step.

Raw command lines are classified per ;-separated part, so ClearAll ; Store Group 5 is DESTRUCTIVE, and a bare number (which can answer an open pop-up) is too.

IMPORTANT

Command injection prevention: Line breaks (\r, \n) are rejected before any command reaches the console. The telnet client also strips them as a defense-in-depth measure.

Keyword Classification

The vocabulary classifies all 157 grandMA2 keywords into categories:

Category

Count

Description

Examples

OBJECT

56

Console objects (nouns)

Channel, Fixture, Group, Preset, Executor

FUNCTION

90

Actions (verbs)

Store, Delete, Go, At, Kill, List, Info

HELPING

5

Syntax connectors

And, Thru, Fade, Delay, If

SPECIAL_CHAR

6

Operator symbols

Plus +, Minus -, Dot ., Slash /

Object Keywords carry additional metadata from live telnet verification:

Field

Description

context_change

Whether the keyword changes the [default]> prompt context

canonical

Console-normalized spelling (e.g., DMX → Dmx)

notes

Behavior notes from live telnet testing

Of the 56 Object Keywords: 53 change the default prompt context and 3 don't (Full, Normal, Zero — these set dimmer values). Channel and Default have context_change=True; their notes describe resetting the default keyword, not the prompt context.

Console aliases:

Input

Resolves To

DMX

Dmx

DMXUniverse

DmxUniverse

Sound

SoundChannel

RDM

RdmFixtureType

from src.vocab import build_v39_spec, classify_token

spec = build_v39_spec()

result = classify_token("Delete", spec)
# result.risk == RiskTier.DESTRUCTIVE
# result.canonical == "Delete"
# result.category == KeywordCategory.FUNCTION

result = classify_token("Channel", spec)
# result.risk == RiskTier.SAFE_WRITE
# result.category == KeywordCategory.OBJECT

result = classify_token("DMX", spec)
# result.canonical == "Dmx"  (alias resolution)

RAG Pipeline

graph LR
    A[Crawl] --> B[Chunk] --> C[Embed] --> D[Store<br/>SQLite] --> E[Query] --> F[Rerank]

    style A fill:#264653,color:#fff
    style B fill:#2a9d8f,color:#fff
    style C fill:#e9c46a,color:#000
    style D fill:#f4a261,color:#000
    style E fill:#e76f51,color:#fff
    style F fill:#e63946,color:#fff
# Ingest repository with real embeddings
uv run python scripts/rag_ingest.py --provider github -v

# Semantic search
uv run python scripts/rag_query.py "store cue with fade" -v

# Text-only keyword search (no token needed)
uv run python scripts/rag_query.py "store cue with fade"

Provider

Flag

Requires

GitHub Models

--provider github

GITHUB_MODELS_TOKEN

Zero-vector stub

--provider zero

Nothing (for testing)

Auto-detect

(no flag)

Uses GitHub if token set, otherwise zero-vector

Ingest

Stage

Module

Description

Crawl

rag/ingest/crawl_repo.py

Walk repo files, respect ignore patterns

Chunk

rag/ingest/chunk.py

Split into overlapping token-bounded chunks

Extract

rag/ingest/extract.py

Extract symbol names (functions, classes, headings)

Embed

rag/ingest/embed.py

Generate vectors via GitHub Models API

Store

rag/store/sqlite.py

Write chunks + vectors to SQLite

Retrieve

Stage

Module

Description

Query

rag/retrieve/query.py

Embed query, cosine similarity search

Rerank

rag/retrieve/rerank.py

Sort and filter results by relevance

Language

Strategy

Boundary

Python

AST-based

Top-level def/class boundaries via ast.parse

Markdown

Heading-based

# heading lines

Other

Line-based

Fixed-size line windows with overlap

Defaults: max 1200 tokens/chunk, 20-line overlap. Configured in rag/config.py.

Console Navigation

The navigation system combines three layers to discover console state via telnet:

  1. Command builder (changedest()) generates cd strings with MA2 dot notation

  2. Telnet client sends the command and captures the raw response

  3. Prompt parser extracts the current location from the response

Pattern

Example

Parsed

Bracket prompt

[Group 1]>

location=Group 1, type=Group, id=1

Dot notation

[Group.1]>

location=Group.1, type=Group, id=1

Compound ID

[Preset.4.1]>

location=Preset.4.1, type=Preset, id=4.1

Trailing slash

[Sequence 3]>/

location=Sequence 3, type=Sequence, id=3

Angle bracket

Root>

location=Root, type=Root

After cd-ing into a destination, list returns tabular output. The parser automatically detects headers and maps columns.

Field

Description

object_type

Type name (e.g. Group, UserImage)

object_id

Numeric ID within the parent

name

Display name

columns

Dict mapping extra header names to values

raw_line

Full original line for manual inspection

Tree Scanner

scripts/scan_tree.py recursively walks the grandMA2 object tree via Telnet, building a complete JSON map of every node.

# Quick scan (depth 4)
uv run python scripts/scan_tree.py --max-depth 4 --output scan_test.json

# Full scan (depth 20)
uv run python scripts/scan_tree.py --max-depth 20 --output scan_full.json

# Resume an interrupted scan
uv run python scripts/scan_tree.py --max-depth 20 --output scan_full.json --resume

Flag

Default

Description

--host

from .env

Console IP address

--port

30000

Telnet port

--max-depth

20

Maximum recursion depth

--max-nodes

0

Stop after N nodes (0 = unlimited)

--max-index

60

Fallback index limit

--failures

3

Stop branch after N consecutive missing indexes

--output

scan_output.json

Output JSON file path

--delay

0.08

Seconds between commands

--resume

false

Resume scan from progress file

Speed optimizations:

  • Known leaf-type shortcutting — skips cd+list for known leaf types

  • Smart gap probing — only fills gaps ≤5 between known IDs

  • Duplicate detection — compares raw list signatures to skip identical subtrees

  • Consecutive empty leaf early exit — stops after 10 empty slots

Resilience:

  • Auto-reconnect with full path recovery

  • Progressive save to JSONL after each root branch

  • Resume support across sessions

  • Heartbeat logging and branch timeouts

Command Builders

The command builder layer (src/commands/) generates grandMA2 command strings as pure functions — no network I/O. 198 exported functions (206 exports including 8 constants) covering navigation, selection, playback, values, store, delete, assign, label, and more.

grandMA2 syntax: [Function] [Object] — keywords are Function (verbs), Object (nouns), or Helping (prepositions).

Navigation

Function

Output

changedest("/")

cd /

changedest("..")

cd ..

changedest("Group", 1)

cd Group.1

changedest("Preset", "4.1")

cd Preset.4.1

Object Keywords

Function

Output

fixture(34)

fixture 34

group(3)

group 3

preset("color", 5)

preset 4.5

cue(5)

cue 5

sequence(3)

sequence 3

executor(1)

executor 1

dmx(101, universe=2)

dmx 2.101

attribute("Pan")

attribute "Pan"

Selection & Clear

Function

Output

select_fixture(1, 10)

selfix fixture 1 thru 10

select_fixture([1, 3, 5])

selfix fixture 1 + 3 + 5

clear()

clear

clear_all()

clearall

Store

Function

Output

store("macro", 5)

store macro 5

store_cue(1, merge=True)

store cue 1 /merge

store_preset("dimmer", 3)

store preset 1.3

store_group(1)

store group 1

Playback

Function

Output

go("executor", 3)

go executor 3

go_executor(3)

go executor 3

go_back("executor", 3)

goback executor 3

go_back_executor(3)

goback executor 3

goto(3)

goto cue 3

go_sequence(1)

go+ sequence 1

go_macro(2)

go macro 2

on_executor(3)

on executor 3

off_executor(3)

off executor 3

flash_executor(3)

flash executor 3

swop_executor(3)

swop executor 3

solo_executor(3)

solo executor 3

top_executor(3)

top executor 3

stomp_executor(3)

stomp executor 3

release_executor(3)

release executor 3

goto_cue(1, 5)

goto cue 5 sequence 1

pause_sequence(1)

pause sequence 1

goto_timecode(1, "00:01:30:00")

goto timecode 1 "00:01:30:00"

go_fast_forward()

>>>

go_fast_forward(executor=[1, 2, 3])

>>> executor 1 + 2 + 3

go_fast_back()

<<<

go_fast_back(executor=[2, 4])

<<< executor 2 + 4

load_next()

loadnext

load_prev()

loadprev

def_go_forward()

defgoforward

def_go_back()

defgoback

def_go_pause()

defgopause

solo()

solo

blind()

blind

freeze()

freeze

blackout()

blackout

At (Values)

Function

Output

at(75)

at 75

at_full()

at full

attribute_at("Pan", 20)

attribute "Pan" at 20

fixture_at(2, 50)

fixture 2 at 50

Copy, Move, Delete

Function

Output

copy("group", 1, 5)

copy group 1 at 5

move("group", 5, 9)

move group 5 at 9

delete("cue", 7)

delete cue 7

Label & Appearance

Function

Output

label("group", 3, "All Studiocolors")

label group 3 "All Studiocolors"

appearance("preset", "0.1", red=100)

appearance preset 0.1 /r=100

appearance("group", 1, color="FF0000")

appearance group 1 /color=FF0000

NOTE

Appearance RGB uses0–100 percentage scale (not 0–255). HSB: hue 0–360, sat/bright 0–100.

Import / Export

Function

Output

export_object("Group", 1, "mygroups")

export Group 1 "mygroups"

import_object("mygroups", "Group", 5)

import "mygroups" at Group 5

Variables

Function

Output

set_var("myvar", 42)

setvar "myvar" 42

set_user_var("speed", 100)

setuservar "speed" 100

Project Structure

grandma2-mcp/
├── src/
│   ├── server.py                           # FastMCP server (184 interactive tools)
│   ├── server_orchestration_tools.py       # Agentic layer (34 tools, IDs 110–144 excluding 130)
│   │
│   │   # Orchestration & Memory
│   ├── orchestrator.py                     # Multi-agent task runner + session memory
│   ├── task_decomposer.py                  # NL goal → ordered SubTask plan
│   ├── agent_memory.py                     # WorkingMemory + LongTermMemory (SQLite)
│   ├── console_state.py                    # ConsoleStateSnapshot (19-gap hydration)
│   ├── pool_name_index.py                  # Object name/ID registry (zero-cost resolve)
│   ├── telemetry.py                        # Per-tool invocation recorder (tool_invocations table)
│   ├── skill.py                            # Skill dataclass + SkillRegistry (versioned playbooks)
│   ├── skill_improver.py                   # SkillImprover: repair suggestions + promotion candidates
│   │
│   │   # Security & Auth
│   ├── auth.py                             # OAuth 2.1 scope enforcement
│   ├── credentials.py                      # OAuth tier → console credentials
│   ├── rights.py                           # MA2 native rights + telnet feedback
│   ├── session_manager.py                  # Telnet session pool (LRU + keepalive)
│   │
│   │   # Core I/O & Parsing
│   ├── telnet_client.py                    # Async Telnet (telnetlib3, injection prevention)
│   ├── navigation.py                       # cd + list + scan orchestration
│   ├── prompt_parser.py                    # Telnet prompt & tabular list parser
│   ├── vocab.py                            # 157 keywords, risk tiers, functional domains
│   │
│   │   # Command Builders & ML
│   ├── commands/                           # 198 exported command-builder functions
│   │   ├── busking.py                      # Busking/performance builders (6 functions)
│   │   ├── objects/                        # Object keywords (9 modules)
│   │   └── functions/                      # Function keywords (17 modules)
│   └── categorization/                     # ML tool categorization (K-Means)
│
├── rag/                                    # RAG pipeline
│   ├── ingest/                             # crawl → chunk → embed → store
│   ├── retrieve/                           # query → rerank
│   └── store/                             # SQLite vector store (rag.db)
├── scripts/
│   ├── rag_ingest.py                       # Ingest repo (zero-vector or real embeddings)
│   ├── rag_ingest_web.py                   # Crawl MA2 help docs (daily batches)
│   ├── rag_query.py                        # Query RAG store from CLI
│   ├── bootstrap_console_users.py          # Create 5 console user accounts
│   ├── create_matricks_library.py          # MAtricks combinatorial library (625 items)
│   ├── create_filter_library.py            # Filter library XMLs (168 items with VTE)
│   └── strategic_scan.py                   # Fast 4-phase console tree scan (~24 min)
├── tests/
├── doc/                                    # Command builders ref + cd-tree docs
├── vscode-mcp-provider/                    # VS Code MCP extension
└── .claude/                                # Skills (playbooks) + scoped rules
    ├── skills/                             # 44 agent instruction modules
    └── rules/                              # 5 scoped rule files (loaded on demand)

Dependencies

Package

Purpose

mcp>=1.21.0

Model Context Protocol server framework

python-dotenv>=1.0.0

Load .env configuration

telnetlib3>=2.0.8

Async Telnet client

beautifulsoup4>=4.12.0

HTML parsing for RAG web crawler

numpy>=1.26.0

K-Means clustering for tool categorization

pytest>=9.0.1

Testing (dev)

pytest-asyncio>=1.3.0

Async test support (dev)

Requires Python ≥ 3.12.

Development

# Run all tests
make test                             # or: uv run python -m pytest -v

# Run a subset
uv run python -m pytest tests/test_vocab.py  # single file
uv run python -m pytest tests/test_rag_*.py  # RAG tests only

# Start MCP server
uv run python -m src.server

# Login test
uv run python scripts/main.py

Troubleshooting

Problem

Solution

Connection fails

Verify console IP/port, check Telnet is enabled, check firewall

Authentication errors

Confirm username/password, check user exists on console

Command not working

Verify syntax against MA2 User Manual, ensure objects exist

RAG ingest 401

Verify GITHUB_MODELS_TOKEN has models:read scope

RAG query empty

Run scripts/rag_ingest.py first, check rag/store/rag.db exists

License

Apache 2.0

Available Tools

237 tools
abort_taskA
    Mark a task session as aborted and return its completion status.

    Looks up the session in long-term memory and surfaces its completed/failed
    step list with an aborted label. Use this when a running task must be halted
    mid-way or when a completed session needs to be retroactively voided.

    Args:
        session_id: 8-char session ID from list_agent_sessions or run_task output.
        reason:     Abort reason string (default "user_requested").

    Returns:
        str: JSON with aborted, session_id, reason, steps_completed, steps_failed.
    

Inputs: session_id (required), reason. Returns: result

adjust_value_relativeB
Nudge an attribute value by a relative delta on the current (or specified) selection.

Args:
    delta: Relative change (positive or negative, non-zero). E.g. +10 or -5.
    attribute_name: Attribute to target (e.g. "Pan", "Tilt", "Dimmer"). Optional.
    fixture_ids: Select these fixtures before nudging. Optional.
    end_id: End of fixture range. Optional.

Returns:
    str: JSON result with commands sent

Inputs: delta (required), end_id, fixture_ids, attribute_name. Returns: result

agent_token_reportB
    Report token consumption across recent agent sessions.

    Args:
        limit: Number of sessions to analyse
    

Inputs: limit. Returns: result

analyze_patch_typesA
Build a fixture-type model of the current patch (SAFE_READ).

Groups patched fixtures by fixture type, classifies each type into a
category (wash/mover/bar/strobe/blinder/conventional/other), and resolves
attribute capabilities (dimmer/position/gobo/color_mix/beam/focus/control)
either from live EditSetup attribute discovery or a curated fallback table.

This is the foundation for verify_fixture_id_blocks,
select_fixtures_by_type_order, run_preset_plugin, and
create_presets_for_patch.

Args:
    discover_attributes: When True, read each fixture type's ChannelType
        rows from the console (slower — several cd/list round-trips per
        type). When False, use the curated fallback capability table.

Returns:
    str: JSON with types (capabilities, category, members), categories,
    unmatched_fixtures, fixture_count, risk_tier.

Inputs: discover_attributes. Returns: result

answer_console_popupA
Answer a console pop-up a previous tool reported as pending_popup.

Pass the option number from pending_popup.options. Choosing the Cancel
option is always allowed (give its number as cancel_option); any other
answer can confirm an overwrite or delete and needs confirm_destructive=True.

Args:
    choice: Option number to press (e.g. 1 for "Ok").
    cancel_option: The pop-up's Cancel option number, when known.
    confirm_destructive: Required for any answer other than Cancel.

Returns:
    str: JSON with command_sent and raw_response.

Inputs: choice (required), cancel_option, confirm_destructive. Returns: result

apply_presetA
Apply a preset to fixtures or groups.

Presets are stored lighting looks (color, position, gobo, etc.) that
can be recalled by type and ID. Optionally select fixtures/group first.

Preset types: "dimmer" (1), "position" (2), "gobo" (3), "color" (4),
"beam" (5), "focus" (6), "control" (7), "shapers" (8), "video" (9)

Args:
    preset_type: Preset type name or number (e.g. "color", "position", "4")
    preset_id: Preset number within that type
    fixture_id: Optional fixture to select first (single or range start)
    fixture_end: Optional end fixture for range selection
    group_id: Optional group to select first (alternative to fixture_id)

Returns:
    str: JSON with commands_sent and raw_response.

Examples:
    - Apply color preset 3 to current selection: preset_type="color", preset_id=3
    - Apply position preset 1 to group 2: preset_type="position", preset_id=1, group_id=2
    - Apply gobo preset 5 to fixtures 1-10: preset_type="gobo", preset_id=5, fixture_id=1, fixture_end=10

Inputs: preset_id (required), preset_type (required), group_id, fixture_id, +1 more. Returns: result

approve_skillA
    Approve a DESTRUCTIVE-scope skill for agent use.

    Sets ``approved=True`` on the named skill.  Once approved, agents
    with sufficient OAuth scope may invoke the skill's playbook.

    This tool requires ``OAuthScope.SYSTEM_ADMIN`` (tier 5 / ``GMA_SCOPE=tier:5``).
    It is the human gate that prevents autonomous DESTRUCTIVE skill promotion.

    Args:
        skill_id: UUID of the skill to approve.
    

Inputs: skill_id (required). Returns: result

architect_preset_libraryA

Architect a complete preset library against the current patch.

Strategies (per spec §C.4):
  - ``full-coverage`` — universal color (8 hues + warm/cool wash) + position
    + selective gobo/beam/focus/control + MIB for movers
  - ``minimal-viable`` — 4 cardinal hues only, no position/selective
  - ``color-first`` — 12-hue wheel + warm/cool + minimal position

Args:
    patch_filter: MA2 selection spec to constrain — None scans whole patch.
        (Path A note: filter wired through patch_reader's existing scope.)
    strategy: One of ``full-coverage`` | ``minimal-viable`` | ``color-first``.
    dry_run: When True, build the plan but don't send any commands.
    confirm_destructive: Required for ``dry_run=False``.

Returns:
    JSON envelope: ``{strategy, reference_fixtures, plan, coverage_report,
    naming_convention, expert_review, summary, dry_run, executed_steps, blocked}``.

Inputs: dry_run, strategy, patch_filter, confirm_destructive. Returns: result

assert_fixture_existsA
    Assert that a fixture ID exists in the console patch.

    Two-tier lookup:
      1. If a ConsoleStateSnapshot is available and the Fixture pool is
         indexed, performs a zero-telnet check against the in-memory index.
      2. Otherwise sends `list fixture {id}` via telnet and checks for
         "NO OBJECTS FOUND" in the response (same mechanism as park_fixture).

    Use this before any selection or programming operation when the fixture
    ID is not guaranteed to be in the current patch.

    Args:
        fixture_id: The numeric fixture ID to check (e.g. 101).

    Returns:
        str: JSON with exists, fixture_id, source ("snapshot" or "live_telnet"),
             and a hint if the fixture is not found.
    

Inputs: fixture_id (required). Returns: result

assert_preset_existsA
    Assert that a preset slot exists in the snapshot's pool inventory.

    Pre-flight check before store_preset or store_cue. Reads from snapshot
    name index — zero telnet cost.

    Args:
        preset_type: PresetType ID (1=Dimmer, 2=Position, 3=Gobo, 4=Color,
                     5=Beam, 6=Focus, 7=Control).
        preset_id: The preset slot ID to check.

    Returns:
        str: JSON with exists bool, preset_type, preset_id, and optional warning.
    

Inputs: preset_id (required), preset_type (required). Returns: result

assert_selection_countA
    Assert that $SELECTEDFIXTURESCOUNT matches an expected value.

    Eval step for SelectionAgent. Reads from snapshot — zero telnet cost.
    A mismatch usually indicates a world/filter/park issue.

    Args:
        expected: Expected fixture count.
        tolerance: Acceptable delta (default 0 — exact match).

    Returns:
        str: JSON with passed bool, actual count, expected count, and message.
    

Inputs: expected (required), tolerance. Returns: result

assert_showfile_unchangedA
    Verify the currently open show matches the baseline captured at last hydration.

    Performs a live ListVar read and compares $SHOWFILE against the cached
    ConsoleStateSnapshot. Use this before committing a batch of DESTRUCTIVE
    changes to confirm the operator has not loaded a different show since
    the last hydrate_console_state call.

    Returns:
        JSON with {"ok": true, "showfile": name} when unchanged.
        JSON with {"ok": false, "expected": baseline, "actual": live}
        when the show has changed.
        JSON with {"ok": false, "reason": "..."} when not yet hydrated
        or telnet is unavailable.

    Risk tier: SAFE_READ
    

Inputs: no named parameters. Returns: result

assign_cue_triggerA
Assign a playback trigger type to a cue (DESTRUCTIVE).

Args:
    cue_id: Cue number to assign the trigger to
    sequence_id: Sequence containing the cue
    trigger_type: "go", "follow", "time", or "bpm"
    confirm_destructive: Must be True to execute
    trigger_value: BPM or time value (required for "bpm" and "time")

Returns:
    str: JSON result with command sent

Inputs: cue_id (required), sequence_id (required), trigger_type (required), trigger_value, +1 more. Returns: result

assign_effect_to_executorA
Assign an effect template to a fader executor slot (DESTRUCTIVE).

Binds an effect from the effect library to an executor so the fader controls
effect intensity in live busking mode. This is the core primitive for the
fader-per-effect busking model.

Args:
    effect_id: Effect pool ID to assign (1-based).
    executor_id: Target executor slot number on the page.
    page: Optional page number. When given, qualifies as 'Page {page}.{exec}'.
    confirm_destructive: Must be True to execute (DESTRUCTIVE — modifies executor assignment).

Returns:
    JSON result with command sent and console response.

Inputs: effect_id (required), executor_id (required), page, confirm_destructive. Returns: result

assign_executor_propertyA
Assign any of the 22 settable options to an executor (DESTRUCTIVE).

Always uses page-qualified addressing (page.executor_id) to avoid Error #66.

Valid options (case-sensitive):
  Layout:   width (1-5)
  Priority: priority (low|normal|high|htp|swap|super)
  Start:    autostart, autostop, autofix, autostomp, restart
  Protect:  ooo, swopprotect, killprotect
  Playback: softltp, wrap, crossfade (off|a|b|ab — requires width>=2), chaser
  Timing:   triggerisgo, cmddisable, effectspeed, autogo
  Speed:    speed (0-65535 BPM), speedmaster (speed_individual|speed1-16),
            ratemaster (rate_individual|rate1-16)

Args:
    executor_id: Executor ID (e.g. 203).
    option: Option name from the list above.
    value: Value to assign (e.g. 2, "on", "high", "speed1").
    confirm_destructive: Must be True to execute.
    page: Page number (default 1). Always included in the address.

Returns:
    str: JSON with command_sent, raw_response, risk_tier.

Inputs: value (required), option (required), executor_id (required), page, +1 more. Returns: result

assign_objectA
Assign objects, functions, fades, or layout positions on the console.

SAFETY: This is a DESTRUCTIVE operation. Requires confirm_destructive=True.

Args:
    mode: Assignment mode:
        "assign" — assign source object to target (e.g. sequence to executor)
        "function" — assign a function to an executor (e.g. Toggle, Flash)
        "fade" — assign a fade time to a cue
        "layout" — assign an object to a layout position
        "empty" — deactivate an executor (assign empty function)
        "temp_fader" — assign temp fader function to an executor
    confirm_destructive: Must be True to execute (safety gate)
    source_type: Source object type (for "assign" and "layout" modes)
    source_id: Source object ID (for "assign" and "layout" modes)
    target_type: Target object type (for "assign", "function", "empty", "temp_fader")
    target_id: Target object ID
    function: Function name for "function" mode (e.g. "Toggle", "Flash", "Go")
    fade_time: Fade time in seconds for "fade" mode
    cue_id: Cue ID for "fade" mode
    sequence_id: Sequence ID for "fade" mode
    layout_id: Layout ID for "layout" mode
    x: X position for "layout" mode
    y: Y position for "layout" mode
    noconfirm: Skip console confirmation dialog

Returns:
    str: JSON with command_sent, raw_response, or block info.

Examples:
    - Assign sequence 1 to executor 6: mode="assign", source_type="sequence",
      source_id=1, target_type="executor", target_id=6
    - Assign Toggle to executor 101: mode="function", function="Toggle",
      target_type="executor", target_id=101
    - Assign fade 3s to cue 5: mode="fade", fade_time=3, cue_id=5
    - Assign group to layout: mode="layout", source_type="group", source_id=1,
      layout_id=1, x=5, y=2
    - Empty executor 1: mode="empty", target_type="executor", target_id=1

Inputs: mode (required), x, y, cue_id, +10 more. Returns: result

assign_temp_faderA
Set the temp fader level on the currently selected executor (SAFE_WRITE).

TempFader crossfades the cue on when pulled up and crossfades the cue off
when pulled down, relative to the given value. The value range is 0–100.

Args:
    value: Fader level 0–100 (default 50). 0 = full off, 100 = full on.

Returns:
    JSON with command_sent and raw_response from the console.

Inputs: value. Returns: result

assign_world_to_user_profileA
Assign a World (fixture visibility mask) to a User Profile (DESTRUCTIVE — Admin only).

Restricts all Users assigned to this profile to only access fixtures and attributes
visible in the specified World. Use world_slot=0 to remove the restriction (None).

Args:
    user_profile_slot: UserProfile slot number to modify
    world_slot: World slot number (0 = no restriction / remove World assignment)
    confirm_destructive: Must be True to execute

Returns:
    str: JSON result with command sent

Inputs: world_slot (required), user_profile_slot (required), confirm_destructive. Returns: result

audit_page_consistencyA
Audit an executor page for layout consistency issues (SAFE_READ).

Checks: all executors labeled, speed masters assigned, first-button
protocol followed, no orphan executors, consistent naming.

Args:
    page: Executor page to audit (default 1).

Returns:
    str: JSON with checks[], overall_status, recommendation.

Inputs: page. Returns: result

auto_number_cuesA
Renumber all cues in a sequence with configurable start and spacing (DESTRUCTIVE).

Lists existing cues, then moves each to its new number. Useful for cleaning
up cue lists with irregular numbering (e.g. 1, 1.5, 3, 7 → 1, 2, 3, 4).

Args:
    sequence_id: Sequence to renumber.
    start: Starting cue number (default 1.0).
    spacing: Increment between cues (default 1.0).
    confirm_destructive: Must be True to execute (DESTRUCTIVE operation).

Returns:
    str: JSON with cues_renumbered, old_to_new mapping, commands.

Examples:
    - Standard: sequence_id=1 → cues become 1, 2, 3, ...
    - By tens: sequence_id=1, start=10, spacing=10 → 10, 20, 30, ...

Inputs: sequence_id (required), start, spacing, confirm_destructive. Returns: result

batch_labelA
Label multiple objects in a single call (DESTRUCTIVE).

Instead of calling label_or_appearance once per object, batch_label applies
names to an entire list. Accepts a JSON array of {id, name} pairs.

Args:
    object_type: Object type (e.g. "group", "sequence", "macro", "preset")
    items: JSON array string, e.g. '[{"id": 1, "name": "Front Wash"}, {"id": 2, "name": "Back Light"}]'
    confirm_destructive: Must be True to execute (DESTRUCTIVE operation)

Returns:
    str: JSON with labels_applied, commands, errors, risk_tier.

Examples:
    - Label groups 1-3: object_type="group", items='[{"id":1,"name":"Front"},{"id":2,"name":"Back"},{"id":3,"name":"Side"}]'

Inputs: items (required), object_type (required), confirm_destructive. Returns: result

blackout_toggleA
Toggle master blackout (kills all lighting output).

Blackout is a toggle — call once to enable, again to disable.
SAFE_WRITE because it is easily reversible.

Returns:
    str: JSON with command_sent, raw_response, risk_tier.

Inputs: no named parameters. Returns: result

block_unblock_cueA
Block or Unblock a cue (DESTRUCTIVE — modifies cue data in the show file).

Block makes a cue store all active values and stop tracking from prior cues.
Unblock removes the block flag, allowing values to track through again.

Args:
    action: "block" or "unblock"
    cue_id: Cue number to block/unblock
    sequence_id: Sequence ID to scope the command (optional)
    end: End cue ID for range (thru syntax)
    confirm_destructive: Must be True to execute

Returns:
    str: JSON result with command sent

Inputs: action (required), cue_id (required), end, sequence_id, +1 more. Returns: result

browse_effect_libraryB
Browse the grandMA2 effect library (SAFE_READ).

Lists all available effect templates that can be applied to fixtures.

Returns:
    JSON with command_sent and raw_response from the console.

Inputs: no named parameters. Returns: result

browse_macro_libraryA
Browse the grandMA2 macro library (SAFE_READ).

Lists all available macro templates that can be imported into the show.

Returns:
    JSON with command_sent and raw_response from the console.

Inputs: no named parameters. Returns: result

browse_patch_scheduleA
Browse the fixture patch schedule from LiveSetup.

If fixture_type_id is provided, drills into that specific fixture type
to show its instances (fixtures, DMX addresses, channels).

Args:
    fixture_type_id: Fixture type index to drill into (optional).
                     Omit to see all fixture types.

Returns:
    str: JSON with raw_response, entries, risk_tier.

Inputs: fixture_type_id. Returns: result

browse_plugin_libraryA
Browse the grandMA2 plugin library (SAFE_READ).

Lists all available plugin templates installed on the console.

Returns:
    JSON with command_sent and raw_response from the console.

Inputs: no named parameters. Returns: result

browse_preset_typeA
Browse the feature/attribute tree under a preset type (SAFE_READ).

Navigates the grandMA2 LiveSetup preset-type cd-tree and lists children
at the requested depth. The tree structure (live-verified v3.9.60.65):

  cd 10.2.N       → Features under PresetType N
  cd 10.2.N.M     → Attributes under Feature M
  cd 10.2.N.M.K   → SubAttributes under Attribute K  (leaf level)

Indexes at each level use sequential position (1 = first listed child),
NOT the internal library ID shown in the output.

Args:
    preset_type_id: Preset type to browse (1=Dimmer, 2=Position, 3=Gobo,
        4=Color, 5=Beam, 6=Focus, 7=Control, 8=Shapers, 9=Video)
    depth: How deep to traverse (1=features only, 2=+attributes,
        3=+subattributes). Defaults to 1.

Returns:
    str: JSON with the tree structure at the requested depth.

Inputs: preset_type_id (required), depth. Returns: result

build_layout_for_screenA

Build (and optionally apply) a layout for one of the MA2 screens.

Either ``template`` or ``content`` must be supplied (not both).

Templates (per spec §B.2): ``busking-master`` | ``preset-access`` |
``executor-monitor`` | ``macro-page`` | ``programmer-view`` |
``troubleshoot-view``.

Args:
    screen: Target screen number (1-5 on a full console; 1 on onPC).
    content: Optional list of ContentSpec cells (mutually exclusive with template).
    template: Optional template name (mutually exclusive with content).
    dry_run: When True, build the plan but don't send any commands.
    confirm_destructive: Required for ``dry_run=False`` (layout writes overwrite
        screen content).

Returns:
    JSON envelope: ``{screen, template, plan, content, preview_ascii,
    expert_review, summary, dry_run, executed_steps, blocked}``.

Inputs: screen (required), content, dry_run, template, +1 more. Returns: result

build_show_from_patchA

Build an expert-grade show scaffold from the current patch.

Strategies (per spec §B.1): ``rock-band`` | ``festival`` | ``theatrical``
| ``dj`` | ``broadcast`` | ``corporate``.

Defaults to ``dry_run=True``; mutation requires ``confirm_destructive=True``.
The plan is deterministic for a given (strategy, patch, options) triple,
and every step is run through ``expert_lint(domain="show")`` before return.

Args:
    strategy: One of the six strategies above.
    options: Optional ``ShowBuildOptions`` dict — overrides strategy defaults
        (e.g. ``{"songs": 14}``).
    dry_run: When True, build the plan but do not send any commands.
    confirm_destructive: Required for ``dry_run=False``. The plan is
        destructive — it creates groups, presets, cues, executors, worlds.

Returns:
    JSON envelope: ``{strategy, plan, rationale, expert_review, summary,
    dry_run, executed_steps, blocked}``.

Inputs: strategy (required), dry_run, options, confirm_destructive. Returns: result

bulk_executor_assignA
Assign a sequence to an executor and configure it in one call (DESTRUCTIVE).

Combines assign + optional trigger/priority/fader/label into a single
operation instead of 4-5 separate tool calls.

Args:
    executor_id: Executor number to assign to.
    sequence_id: Sequence number to assign.
    executor_page: Executor page (default 1).
    trigger: Optional trigger type (e.g. "go", "flash", "toggle").
    priority: Optional priority level (e.g. "normal", "high", "super", "htp").
    fader_function: Optional fader function (e.g. "master", "crossfade", "speed").
    label: Optional label for the executor.
    confirm_destructive: Must be True to execute (DESTRUCTIVE operation).

Returns:
    str: JSON with commands_sent, raw_responses, risk_tier.

Examples:
    - Assign seq 1 to exec 101: executor_id=101, sequence_id=1
    - Full setup: executor_id=101, sequence_id=1, trigger="go", priority="high", label="Main Wash"

Inputs: executor_id (required), sequence_id (required), label, trigger, +4 more. Returns: result

call_plugin_toolA
Execute a plugin on the grandMA2 console by ID or name.

Plugins are Lua scripts stored in the Plugin pool. This tool
invokes them using the Plugin keyword.

Args:
    plugin_id: Plugin number (int) or name (str).
    confirm_destructive: Must be True to proceed. Defaults to False (blocked).

Returns:
    str: JSON with command_sent and raw_response.

Inputs: plugin_id (required), confirm_destructive. Returns: result

check_plugin_availableA

Check whether a plugin is loaded in the console plugin pool (SAFE_READ).

Used by skills (notably ``auto-layout-color-picker``) to decide whether to
invoke the plugin path or fall back to manual workflows.

Args:
    plugin_name: Human-readable plugin name (e.g. ``"EcubeColorPicker"``).
    use_cache: When True, reuse cached inventory if fresh.
    cache_ttl_seconds: How long a cached inventory stays fresh.

Returns:
    JSON envelope: ``{plugin_name, available, pool_id, match,
    last_checked_at, source}``.

Inputs: plugin_name (required), use_cache, cache_ttl_seconds. Returns: result

check_pool_availabilityA
Check which slots are occupied and free in an object pool (SAFE_READ).

Navigates to the pool, lists all entries, and computes a full
availability map: occupied slots (with names), free ranges,
next 10 free slots, and contiguous-block analysis.

Use this **before importing XML** to verify target slots are free,
or to find the best slot range for bulk imports (filters, MAtricks).

Valid pool types (case-insensitive):
  Group, Sequence, Preset, Macro, Effect, Gel, World, Filter,
  Form, Timer, Layout, Timecode, Agenda, UserProfile, Camera,
  MAtricks, View, Remote

Numeric cd indexes also accepted (e.g. "13" for Macros, "19" for Filters).

Args:
    pool_type: Pool keyword or numeric cd index.
    start_from: First slot number to check (default 1).
    scan_up_to: Last slot number to check (default 200).
    needed_slots: If set, checks whether N contiguous free slots
        exist and returns can_fit + suggested_start.

Returns:
    str: JSON with occupied_slots, free_ranges, next_free_slots,
         total_occupied, total_free_in_range, largest_contiguous,
         can_fit, suggested_start, risk_tier.

Inputs: pool_type (required), scan_up_to, start_from, needed_slots. Returns: result

check_pool_slot_availabilityA
Check which pool slots are available (empty) and which are occupied in a range.

Pre-flight check before bulk import, PSR, or mass preset creation to prevent
silent overwrites. Safe to run at any time — read-only.

Args:
    pool_type: "sequence", "preset", "group", "macro", "effect", "world",
               "filter", "view", "layout", "timecode"
    slot_range_start: First slot ID to check (inclusive).
    slot_range_end: Last slot ID to check (inclusive).

Returns JSON with:
- pool_type: str
- range: [start, end]
- occupied: list of {slot_id, label} for occupied slots
- available: list of slot_ids that are empty
- first_available_block_of_10: smallest contiguous block of 10 empty slots

Inputs: pool_type (required), slot_range_end (required), slot_range_start (required). Returns: result

classify_show_modeA
Inspect the show and classify its execution mode (SAFE_READ).

Queries the effect and macro libraries to determine whether the current
show is structured for busking (effect-fader model), sequence-driven
playback, or a hybrid of both.

Returns:
    JSON with mode classification and supporting evidence:
    - "busking"  — primarily effects assigned to fader executors
    - "sequence" — primarily cue sequences on executors
    - "hybrid"   — mix of effects and sequences
    - "empty"    — no content detected

Inputs: no named parameters. Returns: result

clear_effects_on_pageA
Release (kill) all effect executors across a page range (SAFE_WRITE).

Sends Off commands to every executor in the range, stopping all running
effects. Use during song transitions to clean up the previous song's state.
Does not change fader positions — use normalize_page_faders for that.

Args:
    page: Fader page number.
    start_exec: First executor slot to release (default 1).
    end_exec: Last executor slot to release (default 20).

Returns:
    JSON result with command count and console response.

Inputs: page (required), end_exec, start_exec. Returns: result

clear_programmerA
Clear the programmer to reset fixture selection and active values.

The programmer holds the current working state — selected fixtures
and any values you've applied. Clearing it gives you a clean slate.

Modes:
- "all": Empty the entire programmer (selection + values)
- "selection": Deselect all fixtures but keep active values
- "active": Deactivate values but keep fixture selection
- "clear": Sequential clear (selection → active → all on repeated calls)

Args:
    mode: Clear mode — "all" (default), "selection", "active", or "clear"

Returns:
    str: JSON with command_sent and raw_response.

Examples:
    - Full reset: mode="all"
    - Just deselect fixtures: mode="selection"
    - Just drop active values: mode="active"

Inputs: mode. Returns: result

clone_objectA
Clone (duplicate with data) one or more objects to new IDs (DESTRUCTIVE).

Clone copies all stored data from the source to the target — unlike Copy
it also migrates all associated cue/preset references.

Args:
    object_type: Object type ("fixture", "group", "sequence", etc.)
    object_id: Source object ID
    target_id: Destination object ID
    end: End ID for source range (thru syntax)
    target_end: End ID for target range
    noconfirm: Suppress confirmation dialog
    confirm_destructive: Must be True to execute

Returns:
    str: JSON result with command sent

Inputs: object_id (required), target_id (required), object_type (required), end, +3 more. Returns: result

companion_button_pressA
Press a button on a running Bitfocus Companion instance via HTTP API (SAFE_WRITE).

Sends a GET request to Companion's REST API to trigger a button press.
Companion must be running and accessible at the specified host/port.

Args:
    page: Companion page number (1-based).
    button: Button index on the page (0-based).
    host: Companion host (default "localhost").
    port: Companion HTTP API port (default 8000).

Returns:
    str: JSON with status, url_called, response text.

Examples:
    - Press button 0 on page 1: companion_button_press(page=1, button=0)
    - Remote Companion: companion_button_press(page=1, button=3, host="192.168.1.50")

Inputs: page (required), button (required), host, port. Returns: result

compare_cue_valuesA
Compare two cues in a sequence and show differences (SAFE_READ).

Lists both cues and diffs the raw console output to help identify
what changes between them. Useful for tracking analysis and cue cleanup.

Args:
    sequence_id: Sequence containing both cues.
    cue_a: First cue number.
    cue_b: Second cue number.

Returns:
    str: JSON with cue_a, cue_b, raw outputs, and line-by-line differences.

Inputs: cue_a (required), cue_b (required), sequence_id (required). Returns: result

compare_patch_to_show_expectationA
Compare the current patch against expected fixture-type counts (SAFE_READ).

Args:
    expected_fixture_types: Comma-separated "Fixture Type=Count" entries.
        Example: "Mac Aura XB=8, Viper Profile=4"

Returns:
    str: JSON with expected vs actual counts, missing types, and fit status.

Inputs: expected_fixture_types (required). Returns: result

confirm_destructive_stepsA
    Preview the DESTRUCTIVE steps in a task plan before running it.

    Decomposes the goal and returns only the steps that require explicit
    human confirmation (risk_tier == DESTRUCTIVE). Show this to the user
    before calling run_task with auto_confirm_destructive=True.

    Args:
        goal:     Natural-language task goal (same as run_task)
        color:    Target color name or hex
        group:    Fixture group name
        sequence: Target sequence number
        cue:      Target cue number
        preset:   Preset name or ID
    

Inputs: goal (required), cue, color, group, +2 more. Returns: result

console_loginA
Authenticate to the grandMA2 console as a specific user.

Sends a Login command over the active Telnet session, switching
the session to the specified user account and rights level.

Args:
    username: Console username (e.g. "operator", "administrator")
    password: Console password

Returns:
    str: JSON with command_sent and raw_response.

Inputs: password (required), username (required). Returns: result

console_logoutB
Log out the current Telnet session user on the grandMA2 console.

Returns:
    str: JSON with command_sent and raw_response.

Inputs: no named parameters. Returns: result

control_chaserA
Control a running chaser (rate, speed, skip, crossfade mode).

Actions:
- "rate"    : Set the rate (0-200, 100 = normal). Requires value.
- "speed"   : Set the BPM speed (0-65535). Requires value.
- "skip_fwd": Skip one step forward (SkipPlus).
- "skip_bk" : Skip one step backward (SkipMinus).
- "xfade_a" : Set crossfade mode A (CrossFadeA).
- "xfade_b" : Set crossfade mode B (CrossFadeB).
- "xfade_ab": Set crossfade mode AB (CrossFadeAB).

Args:
    action: One of: rate, speed, skip_fwd, skip_bk, xfade_a, xfade_b, xfade_ab
    value: Required for rate and speed actions.
    executor_id: Target executor ID (optional; uses selected if omitted).
    page: Page number (default 1).

Returns:
    str: JSON with command_sent and raw_response.

Inputs: action (required), page, value, executor_id. Returns: result

control_executorA
Control an executor: start, stop, flash, swop, solo, top, stomp, or set speed.

set_speed is DESTRUCTIVE (modifies stored data).

Args:
    action: "on", "off", "flash", "swop", "solo", "top", "stomp", or "set_speed"
    executor_id: Executor ID (1-999)
    page: Page number for page-qualified addressing (optional)
    speed_value: BPM value for set_speed (0.0–999.0; required for set_speed)
    confirm_destructive: Must be True when action="set_speed"

Returns:
    str: JSON result with command sent

Inputs: action (required), executor_id (required), page, speed_value, +1 more. Returns: result

control_special_masterA
Set the level of a grandMA2 SpecialMaster (Grand Master, Speed/Rate masters).

Special masters globally control intensity and timing for all playbacks.

Valid master names:
- "grandmaster"     : Grand Master (0-100 %)
- "playbackmaster"  : Playback Master (0-100 %)
- "speed1".."speed16" : Speed Masters (BPM)
- "rate1".."rate16"   : Rate Masters (%)

Args:
    master: Master name (case-insensitive). See valid names above.
    value: Level value appropriate for the master type.

Returns:
    str: JSON with command_sent and raw_response.

Inputs: value (required), master (required). Returns: result

control_timecodeA
Start, stop, or jump to a position in a timecode show.

Args:
    action: "start" (go), "stop" (off), or "goto"
    timecode_id: Timecode show ID (1-256)
    timecode_position: HH:MM:SS:FF position string (required for "goto")

Returns:
    str: JSON result with command sent

Inputs: action (required), timecode_id (required), timecode_position. Returns: result

control_timerA
Start, stop, or reset a console timer.

Args:
    action: "start" (go), "stop" (off), or "reset" (goto)
    timer_id: Timer ID (1-256)

Returns:
    str: JSON result with command sent

Inputs: action (required), timer_id (required). Returns: result

copy_or_move_objectA
Copy or move an object to a new location (DESTRUCTIVE).

SAFETY: Both operations modify show data. Copy duplicates the object,
move relocates it (deleting the original). Requires confirm_destructive=True.

Args:
    action: "copy" or "move"
    object_type: Object type (e.g. "group", "cue", "preset", "macro")
    source_id: Source object ID
    target_id: Destination object ID
    source_end: Optional end ID for range copy/move
    overwrite: Overwrite target if it exists (default False)
    merge: Merge into target if it exists (default False)
    confirm_destructive: Must be True to execute (DESTRUCTIVE operation)

Returns:
    str: JSON with command_sent and raw_response.

Examples:
    - Copy group 1 to 5: action="copy", object_type="group", source_id=1, target_id=5
    - Move macro 3 to 10: action="move", object_type="macro", source_id=3, target_id=10
    - Copy cue range: action="copy", object_type="cue", source_id=1, target_id=20, source_end=10

Inputs: action (required), source_id (required), target_id (required), object_type (required), +4 more. Returns: result

create_console_userA
Create or overwrite a user account in the show file (DESTRUCTIVE — Admin only).

Requires both gma2:user:manage OAuth scope AND confirm_destructive=True.

grandMA2 rights levels:
    0 = None     (view/change views only, no programmer)
    1 = Playback (run show, no store)
    2 = Presets  (update existing presets only)
    3 = Program  (full show programming)
    4 = Setup    (patch, fixture import, console setup)
    5 = Admin    (full access + user/session/show management)

Args:
    slot: User slot number (2-N; slot 1 = Administrator, always exists)
    name: Username (alphanumeric + underscores, no spaces)
    password: Console login password (empty string = no password required)
    rights_level: MA2 rights level 0-5
    confirm_destructive: Must be True to execute

Returns:
    str: JSON result with command sent

Inputs: name (required), slot (required), password (required), rights_level (required), +1 more. Returns: result

create_filter_libraryA
Create a comprehensive Filter library with color-coded pool items (DESTRUCTIVE).

Generates filters for each PresetType (Dimmer, Position, Gobo, Color, Beam,
Focus, Control), useful multi-type combos, and "No X" exclusion filters.
Each filter is color-coded by category and imported as individual XML files.

Optionally generates Value/ValueTimes/Effects on/off variants for each base
filter (7 combos per filter, excluding all-off). V/VT/E toggles are embedded
in the XML as value="false", value_timing="false", effect="false" attributes.

Slot layout (default start_slot=3):
  - Slots 3-9: Single PresetType filters (7 items)
  - Slots 10-16: Combo filters (7 items, if include_combos)
  - Slots 17-23: "No X" exclusion filters (7 items, if include_exclusions)
  - Slots 24+: V/VT/E variants (N_base × 7, if include_vte)

Args:
    start_slot: First pool slot (default 3, preserving system filters 1-2).
    include_combos: Include multi-type combo filters (default True).
    include_exclusions: Include "No X" exclusion filters (default True).
    include_vte: Include Value/ValueTimes/Effects variants (default False).
        When True, generates 7 V/VT/E combos for each base filter.
    fixture_attributes: Show-specific attribute dict (same shape as FILTER_ATTRIBUTES).
        If None, uses hardcoded defaults (Mac 700 + Generic Dimmer).
        Call discover_filter_attributes() first to get accurate values for your show.
    confirm_destructive: Must be True to execute (overwrites filter pool entries).

Returns:
    str: JSON with filters_created, slots, color_scheme summary.

Inputs: start_slot, include_vte, include_combos, fixture_attributes, +2 more. Returns: result

create_fixture_groupA
Create a group containing a specified range of fixtures (DESTRUCTIVE).

This tool selects the specified range of fixtures and saves them as a group.
Optionally, a name can be assigned to the group.

Args:
    start_fixture: Starting fixture number
    end_fixture: Ending fixture number
    group_id: Group number to save
    group_name: (Optional) Group name, e.g., "Front Wash"
    confirm_destructive: Must be True to execute (DESTRUCTIVE operation)

Returns:
    str: Operation result message

Examples:
    - Save fixtures 1 to 10 as group 1
    - Save fixtures 1 to 10 as group 1 with name "Front Wash"

Inputs: group_id (required), end_fixture (required), start_fixture (required), group_name, +1 more. Returns: result

create_matricks_libraryA
Create a full MAtricks combinatorial library (DESTRUCTIVE).

Generates every combination of Wings × Groups × Blocks × Interleave
(values 0 to max_value) as XML with embedded appearance colors and
imports into the MAtricks pool. Colors are instant — no telnet loop needed.

25-color scheme: Wings=hue (Red/YellowGreen/Cyan/Blue/Magenta),
Groups=brightness (100/80/60/45/30).

With max_value=4: 5^4 = 625 pool items, named W0-G0-B0-I0 through W4-G4-B4-I4.

Args:
    max_value: Upper bound for each property (default 4, gives 5^4=625 items).
    start_slot: First pool slot to import into (default 2, slot 1 is Reset).
    confirm_destructive: Must be True to execute (overwrites MAtricks pool entries).

Returns:
    str: JSON with pool_items_created, color_scheme, first_slot, last_slot.

Inputs: max_value, start_slot, confirm_destructive. Returns: result

create_presets_for_patchA
Create presets natively from the patch, capability-aware (DESTRUCTIVE).

Combines the preset-library architect plan (architect_preset_library)
with the fixture-type model: each preset entry is only applied to
fixtures whose type actually has the required capability (color presets
to color-mixing fixtures, position to movers, etc.).

Entries with concrete values (the cardinal color presets) are stored
directly: selection of capable fixtures -> attribute values -> Store
Preset. Entries declared without concrete values (position, gobo, MIB —
which need operator-set reference values) are returned as ``declared``
for manual completion, matching the declared-vs-stored calibration.

Args:
    strategy: full-coverage | minimal-viable | color-first.
    dry_run: When True (default), return the command plan without executing.
    confirm_destructive: Must be True to execute with dry_run=False.

Returns:
    str: JSON with stored_plan (per-preset command lists), declared_only,
    skipped (no capable fixtures), executed_presets, blocked, risk_tier.

Inputs: dry_run, strategy, confirm_destructive. Returns: result

cut_paste_objectA
Cut an object to clipboard, or paste clipboard content at a target (DESTRUCTIVE).

Cut + Paste is a two-step move: Cut prepares the source, Paste places it.
Does not work with cue objects — use copy_or_move_object for cues.

Args:
    action: "cut" or "paste"
    object_type: Object type ("group", "preset", "sequence", "macro", etc.)
    object_id: Source object ID (required for cut; ignored for bare paste)
    target_id: Destination ID (for paste)
    end: End ID for range cut (thru syntax)
    confirm_destructive: Must be True (cut removes the source; paste overwrites)

Returns:
    str: JSON result with command sent

Inputs: action (required), end, object_id, target_id, +2 more. Returns: result

decompose_taskA
    Break a high-level lighting goal into an ordered rule-based plan.

    Returns the plan summary and full step list so you can review
    before executing. Call run_task to actually execute.

    For the richer agent harness in src/server.py, prefer
    plan_agent_goal and run_agent_goal.

    Args:
        goal:     Natural-language intent, e.g. 'blue wash on movers'
        color:    Target color name or hex
        group:    Fixture group name
        sequence: Target sequence number for cue storage
        cue:      Target cue number
        preset:   Preset name or ID to apply
    

Inputs: goal (required), cue, color, group, +2 more. Returns: result

delete_objectA
Delete an object from the show.

SAFETY: This is a DESTRUCTIVE operation. Requires confirm_destructive=True.

Args:
    object_type: Object type (e.g. "cue", "group", "preset", "fixture", "macro")
    object_id: Object ID to delete
    end_id: Optional end ID for range deletion (e.g. cue 1 thru 10)
    confirm_destructive: Must be True to execute (safety gate)

Returns:
    str: JSON with command_sent, raw_response, or block info.

Examples:
    - Delete cue 5: object_type="cue", object_id=5, confirm_destructive=True
    - Delete cues 1-10: object_type="cue", object_id=1, end_id=10, confirm_destructive=True
    - Delete group 3: object_type="group", object_id=3, confirm_destructive=True

Inputs: object_id (required), object_type (required), end_id, confirm_destructive. Returns: result

delete_showA
Delete a show file from disk (DESTRUCTIVE).

Permanently removes the named show file. This cannot be undone.
Requires confirm_destructive=True to proceed.

Args:
    name: Show file name to delete (without extension).
    confirm_destructive: Must be True to execute (safety gate).

Returns:
    JSON with command_sent, raw_response, or block info.

Inputs: name (required), confirm_destructive. Returns: result

delete_userA
Delete a console user account by slot number (DESTRUCTIVE).

The built-in Administrator in slot 1 cannot be deleted.
Requires confirm_destructive=True to proceed.

Args:
    slot: User slot number to delete (2–N). Slot 1 is protected.
    confirm_destructive: Must be True to execute (safety gate).

Returns:
    JSON with command_sent, raw_response, or block info.

Inputs: slot (required), confirm_destructive. Returns: result

detect_console_divergenceA
Diff current console state against the recorded baseline (SAFE_READ).

Detects changes made outside this MCP session — a different show loaded,
user/page changes on the physical desk, pool objects added or deleted
(groups, sequences, macros, worlds, filters). Complements the tracked
snapshot for the write-only dimensions (MAtricks, park, filter VTE) that
have no telnet readback: when the pools or vars moved, assume those
write-trackers are stale too.

Call snapshot_console_baseline first; this tool errors without one.

Returns:
    str: JSON with diverged (bool), changed_vars, pool_changes
    (added/removed IDs per pool), baseline_age_seconds, risk_tier.

Inputs: no named parameters. Returns: result

detect_dmx_address_conflictsA
Scan the patch for DMX address conflicts — fixtures sharing overlapping channel ranges.

Queries list_universes and list_fixtures to build a channel-occupancy map,
then reports any fixtures whose DMX footprint overlaps with another fixture on
the same universe. Safe to run before any patching operation or during a show
health check.

Args:
    universe_id: Check only this universe (1-based). If None, checks all universes.

Returns JSON with:
- conflicts: list of {universe, fixture_a, fixture_b, overlap_channels}
- clean_universes: list of universe IDs with no conflicts
- total_fixtures_checked: int

Inputs: universe_id. Returns: result

detect_programmer_contaminationA
Check for leftover programmer state before critical operations (SAFE_READ).

Detects: selected fixtures, active filters, active worlds, MAtricks state,
highlight/freeze/solo modes, and parked fixtures. Run this before storing
cues, presets, or making show-critical changes.

Returns:
    str: JSON with contaminated bool, checks[], recommendation.

Inputs: no named parameters. Returns: result

detect_tracking_leaksB
Find attributes unintentionally tracking into later cues (SAFE_READ).

Compares adjacent cue pairs to find values that persist without an
explicit Block. Tracking leaks cause unexpected looks in later cues.

Args:
    sequence_id: Sequence to analyze.
    max_cues: Max cues to compare (default 20).

Returns:
    str: JSON with leaks[], total_leaks, recommendation.

Inputs: sequence_id (required), max_cues. Returns: result

diagnose_no_outputA
Diagnostic tree for fixtures not producing output (SAFE_READ).

Runs a series of non-destructive checks to identify why fixtures
may not be responding: Grand Master level, blackout state, park status,
patch, executor state. Returns structured findings.

Args:
    fixture_id: Optional specific fixture to check.
    universe: Optional DMX universe to check.

Returns:
    str: JSON with checks list, each having check name, status (ok/warning/fail), detail.

Inputs: universe, fixture_id. Returns: result

diff_console_stateA
    Compare the current ConsoleStateSnapshot against a caller-supplied baseline.

    Pass a JSON dict with any subset of: active_filter, active_world,
    selected_fixture_count, fader_page, active_user_profile,
    has_unsaved_changes, console_modes, filter_vte, parked_count.
    Unrecognised keys are ignored.

    Args:
        baseline: JSON string with baseline field values to compare against.

    Returns:
        str: JSON with changed_fields, unchanged_count, snapshot_age_seconds.
    

Inputs: baseline (required). Returns: result

diff_cuesA
Structured diff of two cues showing per-attribute changes (SAFE_READ).

More detailed than compare_cue_values — parses attribute names, timing,
labels, and block status. Falls back to raw line diff if parsing fails.

Args:
    sequence_id: Sequence containing both cues.
    cue_a: First cue number.
    cue_b: Second cue number.

Returns:
    str: JSON with changes[], timing_diff, label_diff, block_diff, identical.

Inputs: cue_a (required), cue_b (required), sequence_id (required). Returns: result

disconnect_consoleA
Close this server's Telnet session(s) to the console.

Use it to free the console for another Telnet client or to stop an idle
session; the next tool call reconnects automatically with the current
settings. Does not change any console state.

Returns:
    str: JSON with sessions_closed.

Inputs: no named parameters. Returns: result

discover_consolesA

Discover grandMA2 consoles via UDP broadcast (SAFE_READ).

Path A scope: broadcast only. mDNS path requires the optional
``[mdns]`` install (zeroconf) and is documented for Path B.

Args:
    timeout_seconds: Listen window after the probe is sent.
    network: Optional CIDR to constrain the broadcast (e.g. "192.168.1.0/24").
        None auto-detects local interfaces.
    methods: List of methods to attempt — subset of {"broadcast", "mdns"}.
        Default: ["broadcast"].

Returns:
    JSON envelope: ``{candidates, scanned_networks, elapsed_ms, note}``.

Inputs: methods, network, timeout_seconds. Returns: result

discover_filter_attributesA
Discover actual filter attributes from the current show's fixture library (SAFE_READ).

Browses PresetTypes 1-7 (Dimmer through Control) at depth 2 to collect
attribute names from all patched fixture types. Returns a dict matching the
shape of FILTER_ATTRIBUTES in constants.py but with show-specific values.

Use this before create_filter_library if your show uses fixtures other than
Mac 700 Profile Extended + Generic Dimmer (the defaults in FILTER_ATTRIBUTES).

Returns:
    str: JSON dict mapping category names to attribute name lists.

Inputs: no named parameters. Returns: result

discover_fixture_type_attributesA
Discover attribute names for a fixture type via EditSetup tree navigation (SAFE_READ).

Navigates cd EditSetup → FixtureTypes → type N → first mode → first subfixture → list,
returning ChannelType rows with attribute library names (e.g. PAN, TILT, COLORRGB1).

Use this to confirm which attributes a fixture type exposes before building presets.
Note: Info FixtureType N does NOT return attribute names — this navigation method is
the correct approach (live-verified 2026-03-31).

Args:
    fixture_type_id: Fixture type number (e.g. 4 for Mac Viper Profile 16-bit).

Returns:
    str: JSON with raw_response containing ChannelType rows.

Inputs: fixture_type_id (required). Returns: result

discover_object_namesA
Navigate to an object pool and return all object names for wildcard pattern building.

This is the first step in the discover-names → derive-pattern → wildcard-command
workflow.  The returned names can be used directly with list_objects(),
info(), label(), etc. by passing them as the ``name`` argument with
``match_mode="literal"`` (exact match) or deriving a ``*``-pattern and
using ``match_mode="wildcard"``.

CD scope covered
----------------
Any destination accepted by navigate_console() works here:
  - Keyword form:      "Group", "Sequence", "Preset", "Macro", "Effect", …
  - Numeric index:     "22" (Groups), "25" (Sequences), "17" (Presets), …
  - Dot-notation:      "10.3" (LiveSetup/FixtureTypes)

Object pool destinations (cd 1–42 that have named user objects):
  Group=22, Sequence=25, Preset=17, Macro=13, Effect=24, Gel=16, World=18,
  Filter=19, Form=23, Timer=26, Layout=38, Timecode=35, Agenda=34,
  UserProfile=39, Remote=36.

System-config branches (cd 1=Showfile, cd 2=TimeConfig, cd 3=Settings,
cd 4=DMX_Protocols, …) hold property nodes, not named user objects — they
return empty names and are not useful for wildcard matching.

After this call the console is left at root (cd /).

Args:
    destination: Object pool to inspect.  Any format accepted by
        navigate_console: keyword ("Group"), numeric index ("22"),
        or dot path ("10.3").

Returns:
    str: JSON with destination, entries (id + name), names_only list,
         and a wildcard_tip suggesting how to build a pattern.

Example workflow::

    discover_object_names("Group")
    # → names: ["Mac700 Front", "Mac700 Back", "Wash", "ALL LASERS"]

    # Derive prefix pattern and use with list_objects:
    # list_objects("group", name="Mac700*", match_mode="wildcard")
    # → "list group Mac700*"

Inputs: destination (required). Returns: result

edit_objectA
Edit, cut, or paste objects in the show.

- edit: Opens an object for editing (SAFE_WRITE)
- cut: Removes an object and places it on the clipboard (DESTRUCTIVE)
- paste: Places clipboard contents at a target location (DESTRUCTIVE)

SAFETY: cut and paste are DESTRUCTIVE and require confirm_destructive=True.
edit does not require confirmation.

Args:
    action: "edit", "cut", or "paste"
    object_type: Object type (e.g. "preset", "cue", "group")
    object_id: Object ID (for edit and cut)
    target_id: Target ID for paste destination
    end: End ID for range operations
    confirm_destructive: Must be True for cut/paste (safety gate)

Returns:
    str: JSON with command_sent, raw_response, or block info.

Examples:
    - Edit cue 1: action="edit", object_type="cue", object_id=1
    - Cut preset 4.1: action="cut", object_type="preset", object_id="4.1"
    - Paste to group 5: action="paste", object_type="group", target_id=5

Inputs: action (required), end, object_id, target_id, +2 more. Returns: result

execute_sequenceB
Execute sequence-related operations.

Args:
    sequence_id: Sequence number
    action: Operation type: "go" (execute), "pause" (pause), or "goto" (jump to cue)
    cue_id: (Required for goto) Target cue number

Returns:
    str: Operation result message

Examples:
    - Execute sequence 1
    - Pause sequence 2
    - Jump to cue 5 of sequence 1

Inputs: action (required), sequence_id (required), cue_id. Returns: result

export_objectsA
Export objects from the show file to disk (DESTRUCTIVE — writes files).

Files are written to the grandMA2 data directory. MA2 routes each type
to its own subfolder automatically:
  - Macro → macros/    Effect → effects/    Plugin → plugins/
  - MAtricks → matricks/    Mask → masks/
  - All others → importexport/

On this system: C:\ProgramData\MA Lighting Technologies\grandma\gma2_V_3.9.60\

Supported object types (19 validated):
  group, preset, macro, effect, sequence, view, page, camera, layout,
  form, plugin, matricks, mask, image, executor, timecode, userprofile,
  channel, screen

Preset syntax for object_id:
  - Single preset:  "1.3"  (type 1=Dimmer, 2=Position, 3=Gobo, 4=Color,
                             5=Beam, 6=Focus, 7=Control, 8=Shapers, 9=Video)
  - All of a type:  "1"    (exports all dimmer presets)
  - Range:          "1 thru 5"

Args:
    object_type: Object type (case-insensitive)
    object_id: ID, preset ref ("1.3"), range ("1 thru 5"), or name (UserProfile)
    filename: Output filename — no extension, no path needed
    style: "csv" or "html" — default is xml
    overwrite: Replace existing file without prompting
    confirm_destructive: Must be True to execute

Returns:
    str: JSON with command_sent, raw_response, risk_tier, data_path

Inputs: filename (required), object_id (required), object_type (required), style, +2 more. Returns: result

find_executor_dependenciesB
Inspect a playback executor and extract likely dependencies (SAFE_READ).

Args:
    page: Executor page number.
    executor_id: Executor number on the page.

Returns:
    str: JSON with assignment info, dependency fields, and warnings.

Inputs: page (required), executor_id (required). Returns: result

find_preset_usagesA
Find all sequences and cues that reference a specific preset (SAFE_READ).

Scans sequence cue data for Preset references before you update or delete.
Also reports which executors play sequences that use this preset.

Args:
    preset_type: Preset type name (e.g. "color", "position", "gobo").
    preset_id: Preset slot number.
    max_sequences: Max sequences to scan (default 50, higher = slower).

Returns:
    str: JSON with usages, executor_references, total_references, risk_if_deleted.

Inputs: preset_id (required), preset_type (required), max_sequences. Returns: result

find_unused_objectsA
Find likely unused object candidates using grounded heuristics (SAFE_READ).

Supported types:
  - sequence: not assigned to any hydrated executor
  - macro: not referenced by another macro and not currently active
  - preset: no cue references found via find_preset_usages

Args:
    object_type: One of "sequence", "macro", or "preset".
    max_objects: Max objects to inspect.
    preset_type: Required for object_type="preset".

Returns:
    str: JSON with candidate_unused list and heuristic notes.

Inputs: object_type (required), max_objects, preset_type. Returns: result

fix_locate_fixtureA
Fix (park) or Locate selected/specified fixtures (SAFE_WRITE).

Fix pins fixture output to current level, overriding playback.
Locate fires fixtures to their default state (full, open, centre).

Args:
    action: "fix" or "locate"
    fixture_ids: List of fixture IDs to fix (optional — uses selection if omitted)
    end: End ID for range when a single start ID is given

Returns:
    str: JSON result with command sent

Inputs: action (required), end, fixture_ids. Returns: result

generate_companion_configA
Generate a Bitfocus Companion .companionconfig page from the current MA2 executor layout (SAFE_READ).

Reads the executor page and builds a Companion-importable JSON config
with one button per assigned executor. Each button sends the appropriate
Go+ command via Companion's grandMA2 telnet module.

The output is a JSON string in Companion v4 page-export format. Save it
to a .companionconfig file and import via Companion UI → Buttons → Import.

Args:
    page: MA2 executor page to export (default 1).
    companion_page: Target Companion page number (default 1).
    grid_columns: Companion grid width — 8 for Stream Deck XL, 5 for Stream Deck (default 8).

Returns:
    str: JSON with companion_config (the importable config), executor_count, and instructions.

Examples:
    - Export page 1: generate_companion_config()
    - Export page 2 for Stream Deck: generate_companion_config(page=2, grid_columns=5)

Inputs: page, grid_columns, companion_page. Returns: result

generate_compliance_reportA
Generate a SB 132 / safety-audit compliance report from session telemetry.

Produces a structured report mapping MA2 Agent telemetry fields to
SB 132 documentation requirements: written risk assessment, operator
identification, DESTRUCTIVE operation log, and incident timeline.

Safe to run during any production. Reads telemetry only — no console side effects.

Args:
    session_id: Target session ID. If None, uses all sessions in date range.
    production_name: Name of production for report header.
    operator_name: Console operator name for report header.
    days: Days of telemetry to include (default 1).

Returns a markdown compliance report ready for inclusion in safety documentation.

Inputs: days, session_id, operator_name, production_name. Returns: result

generate_fixture_layer_xmlA
Generate a grandMA2 fixture layer XML file and save it to the importexport directory (DESTRUCTIVE).

The output file can be imported immediately using import_fixture_layer.
No telnet connection required — this tool writes a local file only.

Output directory:
  C:\ProgramData\MA Lighting Technologies\grandma\gma2_V_3.9.60\importexport\

Each fixture dict must contain:
    fixture_id (int): grandMA2 fixture ID (e.g. 111)
    name (str): Display name (e.g. "Dim 1" or "Mac 700 1")
    fixture_type_no (int): Fixture type number from list_fixture_types()
    fixture_type_name (str): Display name of the fixture type
    dmx_address (int): 1-based DMX start address within its universe
    num_channels (int): Total DMX channel count for this fixture type

Args:
    filename: Output filename without extension
    layer_name: Layer display name shown in MA2 UI
    layer_index: Layer index number (1-based) for the <Layer> XML element
    fixtures: List of fixture parameter dicts (see schema above)
    showfile: Show name embedded in XML <Info> element
    overwrite: If True, overwrite existing file; if False, return error on conflict
    confirm_destructive: Must be True to execute (writes files to console importexport directory)

Returns:
    str: JSON with file_path, filename, fixture_count, layer_index, layer_name

Inputs: filename (required), fixtures (required), layer_name (required), layer_index (required), +3 more. Returns: result

generate_ma2_macroA

Generate an MA2 macro from natural-language intent (SAFE_READ when store=False).

Returns ``body_xml`` + lint + expert review. When ``store=True``, the tool
requires ``confirm_destructive=True`` AND ``pool_id``; in Path A the store
branch returns blocked / deferred-to-Path-B rather than mutating the pool.

Args:
    intent: Plain-English description of the macro to build.
    scope_hints: Optional dict of routing hints, e.g. ``{"executor": "1.1.1"}``.
    store: When True, store the generated macro to the macro pool.
    pool_id: Target pool slot (required if ``store=True``).
    confirm_destructive: Required if ``store=True`` (the store path is destructive).

Returns:
    JSON envelope:
    ``{intent, body_xml, line_count, validation, lint, expert_review,
    stored_as, blocked}``.

Inputs: intent (required), store, pool_id, scope_hints, +1 more. Returns: result

generate_song_macro_packA
Draft a song macro pack using a practical busking-page structure (SAFE_READ).

This returns macro labels and line content only. It does not store any
macros on the console.

Args:
    song_name: Human-readable song title.
    sequence_id: Primary playback sequence for the song.
    start_macro_id: First macro ID to assign in the draft pack.
    target_page: Page operators should jump to before loading the song.

Returns:
    str: JSON with draft macro definitions and first-button protocol notes.

Inputs: song_name (required), sequence_id (required), target_page, start_macro_id. Returns: result

get_console_locationA
Query the current grandMA2 console destination without navigating.

Sends an empty command to prompt the console to re-display its
prompt, then parses the response to determine the current location.

Returns:
    str: JSON with raw_response, parsed prompt details,
         and success indicator.

Inputs: no named parameters. Returns: result

get_console_stateA
    Return the cached ConsoleStateSnapshot without re-hydrating.

    Zero telnet cost. Includes staleness flag and full summary.
    Call hydrate_console_state first if the snapshot is missing or stale.

    Returns:
        str: JSON with hydrated, staleness_warning, age_seconds, partial, summary.
    

Inputs: no named parameters. Returns: result

get_executor_detailA
    Return the full ExecutorState for a given executor ID from the snapshot.

    Gap 10. Includes priority, button/fader function, autostart, killprotect.
    Zero telnet cost — reads from snapshot. Call hydrate_console_state first.

    Args:
        executor_id: The executor ID to retrieve.

    Returns:
        str: JSON with all ExecutorState fields, or an error if not found.
    

Inputs: executor_id (required). Returns: result

get_executor_stateA
Read all 32 fields of a single executor via 'List Executor page.id' (SAFE_READ).

Returns all KEY=VALUE fields including Width, Priority, AutoStart, AutoStop,
Crossfade, SpeedMaster, RateMaster, Filter, PlaybackMaster, etc.

Must use page-qualified addressing — bare executor IDs return wrong data.

Args:
    executor_id: Executor ID (e.g. 203).
    page: Page number (default 1).

Returns:
    str: JSON with fields dict, command_sent, raw_response.

Inputs: executor_id (required), page. Returns: result

get_executor_statusA
Query the status of one or all executors (SAFE_READ).

Args:
    executor_id: Executor ID to inspect (optional; lists all if omitted)
    page: Page number for page-qualified addressing (optional)

Returns:
    str: JSON result with raw console response

Inputs: page, executor_id. Returns: result

get_filter_stateA
    Return the active filter ID and V/VT/E layer flags from the snapshot.

    Gap 1. An active filter silently restricts which attributes are stored
    in a cue or preset. Check this before any Store operation.

    Returns:
        str: JSON with active_filter, filter_vte dict, and a warning if active.
    

Inputs: no named parameters. Returns: result

get_improvement_suggestionsA
    Return repair suggestions and promotion candidates from the analyser.

    Repair suggestions: tools failing >= ``min_failures`` times in the
    last ``days`` days, with a human-readable hint for each.

    Promotion candidates: successful sessions not yet promoted to Skills,
    with quality score >= ``min_quality``.

    This tool is read-only — it never writes to the skill registry.

    Args:
        days:          Look-back window for failure detection (default 7).
        min_failures:  Minimum error count to flag a tool (default 3).
        min_quality:   Minimum session quality to suggest promotion (default 0.8).
    

Inputs: days, min_quality, min_failures. Returns: result

get_matricks_stateA
    Return the write-tracked MAtricks programmer state from the snapshot.

    Gap 6. No telnet readback exists for MAtricks — this write-tracker is
    the only source of truth. Updated by manage_matricks on every call.

    Returns:
        str: JSON with all MAtricksTracker fields and a human summary.
    

Inputs: no named parameters. Returns: result

get_object_infoA
Query information about any object in the show.

Returns the console's info response for the specified object,
which includes its properties, status, and metadata.

Args:
    object_type: Object type (e.g. "fixture", "group", "cue",
        "sequence", "preset", "executor", "macro")
    object_id: Object ID. For presets use "type.id" format
        (e.g. "2.1" for color preset 1).

Returns:
    str: JSON with command_sent and raw_response containing
        the object's information.

Examples:
    - Get info on group 3: object_type="group", object_id=3
    - Get info on cue 5: object_type="cue", object_id=5
    - Get info on color preset 1: object_type="preset", object_id="2.1"

Inputs: object_id (required), object_type (required). Returns: result

get_page_mapA
Get a complete topology map of an executor page (SAFE_READ).

Returns every executor with its assignment, fader role, trigger type,
priority, width, and label. Richer than scan_page_executor_layout.

Args:
    page: Executor page number (default 1).

Returns:
    str: JSON with executors[], occupied count, free_slots[], total_slots.

Inputs: page. Returns: result

get_park_ledgerA
    Return all currently parked fixtures from the snapshot ledger.

    Park state is tracked as a write-tracker (Gap 3). Parked fixtures
    silently ignore At commands — check this before any DESTRUCTIVE preset
    or intensity operation.

    Returns:
        str: JSON with parked_fixtures list, count, and a warning if non-empty.
    

Inputs: no named parameters. Returns: result

get_programmer_selectionA
    Return $SELECTEDFIXTURESCOUNT, $SELECTEDEXEC, and $SELECTEDEXECCUE from snapshot.

    Gaps 18 & 19. Zero telnet cost — reads hydrated system variable values.
    Use assert_selection_count to validate count against an expected value.

    Returns:
        str: JSON with selected_fixture_count, selected_exec, selected_exec_cue.
    

Inputs: no named parameters. Returns: result

get_sequence_memoryA
    Return the in-memory SequenceEntry and its CueRecords for a given ID.

    Zero telnet cost — reads from snapshot. Call hydrate_sequences first
    if the sequence is not yet in the snapshot.

    Args:
        sequence_id: The sequence ID to retrieve.

    Returns:
        str: JSON with sequence properties and cue list.
    

Inputs: sequence_id (required). Returns: result

get_showfile_infoA
    Return show identity and host info from the cached ConsoleStateSnapshot.

    Zero telnet cost — reads fields hydrated during hydrate_console_state.
    For live $DATE/$TIME values, use get_variable with var_name=DATE or TIME.

    Returns:
        str: JSON with showfile, version, host_status, active_user, hostname.
    

Inputs: no named parameters. Returns: result

get_similar_toolsA
Find the most similar MCP tools to a given tool (SAFE_READ).

Uses Euclidean distance in the combined feature space (structural +
embedding) from the last clustering run.

Args:
    tool_name: Name of the reference tool (e.g. "playback_action").
    top_n: Number of similar tools to return (default 5).

Returns:
    str: JSON array of similar tools ranked by distance, with category.

Inputs: tool_name (required), top_n. Returns: result

get_skillA
    Return full detail for a single skill including its lineage chain.

    Walks the ``parent_id`` chain to return all ancestor versions
    oldest-first, so you can see how the skill evolved over time.

    Args:
        skill_id: UUID of the skill to retrieve.
    

Inputs: skill_id (required). Returns: result

get_telemetry_reportA
Export tool invocation telemetry as a structured audit report.

Queries the tool_invocations table filtered by session, date range, and/or
risk tier. Returns a structured log suitable for SB 132 compliance reports,
insurance documentation, and safety audits.

Args:
    session_id: Filter to a specific session ID (from list_agent_sessions).
                If None, includes all sessions in the date range.
    days: Number of past days to include (default 1 = today only).
    risk_tier: Filter to "SAFE_READ", "SAFE_WRITE", or "DESTRUCTIVE" only.
               If None, includes all tiers.
    format: "json" (default) or "markdown" for human-readable report.

Returns structured report with:
- header: session info, date range, operator
- risk_summary: counts per tier
- destructive_log: full detail on every DESTRUCTIVE operation
- error_log: any operations that returned errors
- timeline: ordered list of all operations

Inputs: days, format, risk_tier, session_id. Returns: result

get_tool_metricsA
    Return latency and error-rate statistics for a single MCP tool.

    Queries the ``tool_invocations`` telemetry table for all recorded
    calls to ``tool_name`` in the last ``days`` days.

    Returns call count, error rate, p50/p95 latency in milliseconds,
    and the distinct error classes seen.  Returns ``{"calls": 0}`` if
    no invocations have been recorded yet.

    Args:
        tool_name: Exact name of the MCP tool (e.g. "list_objects").
        days: Look-back window in days (default 7).
    

Inputs: tool_name (required), days. Returns: result

get_variableA
Read variables from the console (SAFE_READ).

Args:
    action: One of:
        "echo"         — read any variable via `Echo $NAME` (system + user vars).
                         Use this for built-in system variables: $SELECTEDEXEC,
                         $TIME, $DATE, $VERSION, $FADERPAGE, $BUTTONPAGE,
                         $SELECTEDFIXTURESCOUNT, $USER, $HOSTNAME, $HOSTSTATUS, etc.
        "get_user"     — read a user variable via GetUserVar.
        "list_var"     — list all global show variables.
        "list_user_var"— list all user-profile variables.
    var_name: Variable name (required for "echo" and "get_user").
              May include or omit leading $. E.g. "SELECTEDEXEC" or "$mycounter".

Returns:
    str: JSON with command_sent, raw_response, risk_tier.
         For "echo", also includes `variable` and `value` keys.

Inputs: action (required), var_name. Returns: result

get_world_stateA
    Return the active world ID and known world labels from the snapshot.

    Gap 2. An active world gates which fixtures are visible. Critical for
    multi-universe shows where selection counts vary per world.

    Returns:
        str: JSON with active_world, world_labels dict, and a warning if active.
    

Inputs: no named parameters. Returns: result

highlight_fixturesA
Toggle highlight mode for the currently selected fixtures.

Highlight mode temporarily sets selected fixtures to full intensity to help
identify them on stage. Easily reversible (toggle off).

Args:
    on: True to enable, False to disable highlight mode.

Returns:
    str: JSON with command_sent, raw_response, risk_tier.

Inputs: on. Returns: result

hydrate_console_stateA
    Trigger a fresh ConsoleStateSnapshot hydration on demand.
    Populates all 19 memory gaps + PoolNameIndex for all 16 pool types.

    Call this after load_show, new_show, or before DESTRUCTIVE multi-step tasks.

    Args:
        sequence_ids: Comma-separated sequence IDs for deep cue/part
                      hydration (e.g. "1,2,5"). Leave empty for fast path.
    

Inputs: sequence_ids. Returns: result

hydrate_sequencesA
    Deep-hydrate cues and parts for specific sequence IDs (Gaps 7 & 9).

    Triggers orchestrator.hydrate_snapshot(sequence_ids=[...]) for only the
    requested sequences, avoiding a full console re-scan. Use after
    creating or modifying specific sequences when you need cue detail.

    Args:
        sequence_ids: Comma-separated sequence IDs, e.g. "1,2,5".

    Returns:
        str: JSON with hydrated flag, sequence_ids list, partial flag.
    

Inputs: sequence_ids (required). Returns: result

if_filterB
Apply an If filter to the current selection or command context.

Args:
    filter_type: "active" (bare 'if'), "fixture" (specific fixture), or "attribute"
    fixture_id: Fixture ID (required for "fixture" and "attribute")
    attribute_name: Attribute name (required for "attribute"; e.g. "Pan")

Returns:
    str: JSON result with command sent

Inputs: filter_type (required), fixture_id, attribute_name. Returns: result

import_fixture_layerA
Import a fixture layer XML file into the show patch (DESTRUCTIVE).

Navigates to EditSetup/Layers context, imports the XML layer file,
then returns to root context. Use generate_fixture_layer_xml to
create the XML file before calling this tool.

The file must exist in the MA2 importexport directory:
  C:\ProgramData\MA Lighting Technologies\grandma\gma2_V_3.9.60\importexport\

Args:
    filename: Layer XML filename without extension or path
    layer_index: Target layer slot. None = MA2 picks next free slot
    confirm_destructive: Must be True to execute

Returns:
    str: JSON with steps list (command + response per step), filename, risk_tier

Inputs: filename (required), layer_index, confirm_destructive. Returns: result

import_fixture_typeA
Import a fixture type from the MA2 library into the show (DESTRUCTIVE).

Navigates to EditSetup/FixtureTypes context, imports the fixture type
by 'manufacturer@fixture@mode' key, then returns to root context.

Use list_library(library_type="fixture") first to find the exact key values.

Args:
    manufacturer: Manufacturer name exactly as in MA2 library (e.g. "Martin", "Generic")
    fixture: Fixture model name (e.g. "Mac700Profile_Extended")
    mode: Mode name (e.g. "Extended", "Standard")
    confirm_destructive: Must be True to execute

Returns:
    str: JSON with steps list (command + response per step), fixture_key, risk_tier

Inputs: mode (required), fixture (required), manufacturer (required), confirm_destructive. Returns: result

import_objectsA
Import objects from a file into the show (DESTRUCTIVE — modifies show file).

MA2 locates the file using the destination type to determine the correct
subfolder automatically (same routing as export). The file must exist in
the grandMA2 data directory before calling this tool.

Files are read from: C:\ProgramData\MA Lighting Technologies\grandma\gma2_V_3.9.60\
  - Macro → macros/    Effect → effects/    Plugin → plugins/
  - MAtricks → matricks/    Mask → masks/
  - All others → importexport/

Supported destination types (17 validated):
  group, preset, macro, effect, sequence, view, page, camera, layout,
  form, plugin, matricks, mask, image, executor, timecode, userprofile

(Screen is export-only — import gives RESIZE FORBIDDEN error.)

Preset destination_id format: "T.N"  e.g. "1.99" = Dimmer slot 99

Args:
    filename: Source filename — no extension, no path needed
    destination_type: Object type for placement (REQUIRED — MA2 Error #28 without it)
    destination_id: Slot number or preset ref ("T.N"). None = next free slot.
    quiet: Suppress MA2 feedback output during import
    confirm_destructive: Must be True to execute

Returns:
    str: JSON with command_sent, raw_response, risk_tier

Inputs: filename (required), destination_type (required), quiet, destination_id, +1 more. Returns: result

incident_snapshotA
Capture full console state for incident reporting (SAFE_READ).

Creates a comprehensive snapshot of the current console state including
page, modes, selection, parks, filter/world, active executors, and
recent errors. Use this when something goes wrong on site.

Returns:
    str: JSON with full state capture and human-readable summary.

Inputs: no named parameters. Returns: result

inspect_sessionsA
Inspect active per-operator Telnet session pool (SAFE_READ).

Returns a snapshot of the session manager's current state: how many
sessions are open, which console users they are authenticated as, and
how long each has been idle.  Useful for diagnosing connection issues
in multi-operator deployments.

Returns:
    JSON with session_count and a sessions list, each entry containing:
    identity, username, connected, idle_seconds, age_seconds.

Inputs: no named parameters. Returns: result

label_or_appearanceA
Label or set the appearance of console objects.

SAFETY: This is a DESTRUCTIVE operation. Requires confirm_destructive=True.

Args:
    action: "label" to set a name, "appearance" to set visual styling
    object_type: Object type (e.g. "group", "sequence", "cue", "preset")
    object_id: Object ID
    name: Name to assign (required for action="label")
    end: End ID for range labeling (e.g. group 1 thru 5)
    preset_type: For labeling presets, the preset type (e.g. "color", "position").
        When set, uses the specialized label_preset builder.
    confirm_destructive: Must be True to execute (safety gate)
    color: Hex color string for appearance (e.g. "FF0000")
    red: Red component (0-100) for appearance
    green: Green component (0-100) for appearance
    blue: Blue component (0-100) for appearance
    hue: Hue value for appearance
    saturation: Saturation value for appearance
    brightness: Brightness value for appearance
    reset: Reset appearance to default
    source_type: Copy appearance from this object type
    source_id: Copy appearance from this object ID

Returns:
    str: JSON with command_sent, raw_response, or block info.

Examples:
    - Label group 3: action="label", object_type="group", object_id=3, name="Front Wash"
    - Label color preset 1: action="label", object_type="preset", object_id=1,
      preset_type="color", name="Red"
    - Set group appearance: action="appearance", object_type="group", object_id=1,
      color="FF0000"

Inputs: action (required), object_id (required), object_type (required), end, +13 more. Returns: result

label_worldB
Label an existing World pool object on the grandMA2 console. (DESTRUCTIVE)

Args:
    world_id: World slot number to label (1-256)
    name: Name to assign to the world
    confirm_destructive: Must be True to execute

Returns:
    str: JSON with command_sent and raw_response.

Inputs: name (required), world_id (required), confirm_destructive. Returns: result

lint_macroA
Static analysis of a grandMA2 macro for unsafe patterns (SAFE_READ).

Checks for: destructive commands without gates, broken jump targets,
missing quotes, unsafe raw patterns, potential infinite loops.

Args:
    macro_id: Macro number to lint.

Returns:
    str: JSON with issues[], overall (clean/warning/error), lines_checked.

Inputs: macro_id (required). Returns: result

list_agenda_eventsA
List all Agenda pool objects on the grandMA2 console.

Agendas are time-triggered events (sunrise/sunset/specific time) that can
fire macros or cues automatically. Returns the raw console output of the
List Agenda command, showing all agenda slots and their IDs.

Returns:
    str: JSON with command_sent and raw_response.

Inputs: no named parameters. Returns: result

list_agent_sessionsC
    List recent multi-agent task sessions from long-term memory.

    Args:
        limit: Number of most recent sessions to return (default 10)
    

Inputs: limit. Returns: result

list_console_destinationA
List objects at the current grandMA2 console destination.

After navigating with cd (navigate_console), use this tool to
enumerate children at the current location.  Parses the list
feedback to extract object-type, object-id, and element names.

Args:
    object_type: Optional filter (e.g., "cue", "group", "preset").
        If omitted, lists everything at the current destination.

Returns:
    str: JSON with command_sent, raw_response, and parsed entries
         (each with object_type, object_id, name).

Inputs: object_type. Returns: result

list_console_usersA
List all user accounts in the current show file (SAFE_READ).

Returns the raw `list user` output from the console, showing all
user slots with their names, rights levels, and profile assignments.

Returns:
    str: JSON result with raw console response

Inputs: no named parameters. Returns: result

list_effects_poolA
List all Effect pool objects on the grandMA2 console.

Returns stored effects (not the effect library) from the
Effects pool using the List Effect command.

Returns:
    str: JSON with command_sent and raw_response.

Inputs: no named parameters. Returns: result

list_fader_modulesB
List connected fader modules (SAFE_READ).

Returns information about all fader wing modules currently connected
to the grandMA2 console.

Returns:
    JSON with command_sent and raw_response from the console.

Inputs: no named parameters. Returns: result

list_filtersA
List all Filter pool objects on the grandMA2 console.

Filters restrict which fixture attributes are stored or recalled.
Returns the raw console output of the List Filter command.

Returns:
    str: JSON with command_sent and raw_response.

Inputs: no named parameters. Returns: result

list_fixturesA
List fixtures defined on the console, or check a specific fixture exists.

This is the correct way to discover fixture IDs before using park_fixture,
unpark_fixture, set_intensity, or set_attribute. Note: 'cd Fixture' is NOT
a valid MA2 navigation destination — this tool uses 'list fixture' instead.

Args:
    fixture_id: Optional fixture ID to inspect. If None, lists all fixtures.

Returns:
    str: JSON with command_sent, raw_response, exists (bool), fixture_id.
         exists is always True when fixture_id is None (listing all).

Examples:
    - List all fixtures: list_fixtures()
    - Check fixture 20: list_fixtures(fixture_id=20)
    - Check fixture 1 (likely missing): list_fixtures(fixture_id=1)

Inputs: fixture_id. Returns: result

list_fixture_typesA
List all fixture types in the show (from LiveSetup/FixtureTypes).

Navigates to cd 10 (LiveSetup) -> cd 3 (FixtureTypes) -> list -> cd /

Returns:
    str: JSON with raw_response, entries (fixture type names, manufacturers,
         DMX footprint), risk_tier.

Inputs: no named parameters. Returns: result

list_formsA
List all Form pool objects on the grandMA2 console.

Forms define the waveform shapes used by effects. Returns
the raw console output of the List Form command.

Returns:
    str: JSON with command_sent and raw_response.

Inputs: no named parameters. Returns: result

list_imagesA
List all Image pool objects on the grandMA2 console.

Returns the raw console output of the List Image command,
which shows all user-imported images (for gobo media servers, etc.).

Returns:
    str: JSON with command_sent and raw_response.

Inputs: no named parameters. Returns: result

list_layersA
List all fixture layers in the show (from LiveSetup/Layers).

Navigates to cd 10 (LiveSetup) -> cd 4 (Layers) -> list -> cd /

Returns:
    str: JSON with raw_response, entries (layer names, fixture ranges),
         risk_tier.

Inputs: no named parameters. Returns: result

list_layoutsB
List all Layout pool objects on the grandMA2 console.

Returns the raw console output of the List Layout command,
which shows all defined layout views and their IDs.

Returns:
    str: JSON with command_sent and raw_response.

Inputs: no named parameters. Returns: result

list_libraryB
Browse the console's built-in libraries.

Args:
    library_type: "fixture" (ListLibrary), "effect" (ListEffectLibrary),
                  or "macro" (ListMacroLibrary).

Returns:
    str: JSON with command_sent, raw_response, risk_tier.

Inputs: library_type. Returns: result

list_macro_jump_targetsA
Parse a macro's lines and return all jump targets (Go Macro N."name".L references).

Reads macro lines via the console command tree and identifies all jump
instructions, their current target line numbers, and the total line count.
Use this before inserting or deleting macro lines to build an index-shift table.

Args:
    macro_id: The macro pool ID to inspect.

Returns JSON with:
- macro_id: int
- total_lines: int
- jump_targets: list of {source_line, target_line, raw_command}
- line_listing: ordered list of {line_num, command}

Inputs: macro_id (required). Returns: result

list_pool_namesA
    List all known names and IDs for a pool type from the in-memory index.
    Zero telnet cost.

    Args:
        object_type: Any MA2 pool type (Group, Sequence, Macro, etc.)
        preset_type: For Preset objects only (1-9)
    

Inputs: object_type (required), preset_type. Returns: result

list_preset_poolA
List presets stored in the show's Global preset pool.

Without arguments: returns all PresetPool entries with their counts
(Dimmer, Position, Gobo, Color, Beam, Focus, Control, Shapers, Video).

With preset_type: navigates into that pool and lists individual presets
with their slot number, name, and Special field.

CD tree path navigated:
  cd 17 → cd 1 → list             (pool overview)
  cd 17 → cd 1 → cd N → list      (individual preset type)

Pool index → type mapping (live-verified v3.9.60.65):
  0=ALL  1=DIMMER  2=POSITION  3=GOBO  4=COLOR
  5=BEAM  6=FOCUS  7=CONTROL  8=SHAPERS  9=VIDEO

Note: The "Special" column shows "Normal" (standard) or "Embedded" — it
does NOT indicate Universal vs Selective scope. Scope is an internal flag
only visible in the console GUI or show XML.

Args:
    preset_type: Optional type to drill into. Accepts name ("color", "position")
        or number ("4"). If omitted, returns pool overview.

Returns:
    str: JSON with pool overview or individual preset list.

Inputs: preset_type. Returns: result

list_sequence_cuesA
List cues in a sequence, or check whether a specific cue exists.

Supports two ways to identify the sequence:
  - sequence_id: Direct sequence number (e.g. 278)
  - executor_id: Executor number — sequence is resolved via
    'list executor PAGE.ID' before listing cues

If both are supplied, sequence_id takes precedence.

Validated MA2 probes used:
  'list cue sequence N'     → all cues in sequence N
  'list cue M sequence N'   → specific cue M in sequence N
  'list executor P.E'       → resolve sequence from executor

Args:
    sequence_id: Sequence number to inspect.
    executor_id: Executor number — resolved to its linked sequence.
    executor_page: Executor page for resolution (default 1).
    cue_id: Optional specific cue to check for existence.

Returns:
    str: JSON with command_sent, raw_response, exists, resolved_sequence_id,
         and executor_probe_response (when executor_id was used).

Examples:
    - All cues in seq 278: list_sequence_cues(sequence_id=278)
    - Cue 5 in seq 278: list_sequence_cues(sequence_id=278, cue_id=5)
    - Cues for executor 1: list_sequence_cues(executor_id=1)
    - Check cue 99 on executor 1: list_sequence_cues(executor_id=1, cue_id=99)

Inputs: cue_id, executor_id, sequence_id, executor_page. Returns: result

list_showsB
List available show files on the console.

Returns:
    str: JSON with command_sent, raw_response, risk_tier.

Inputs: no named parameters. Returns: result

list_skillsA
    Search the skill registry for stored playbooks.

    If ``query`` is provided, performs a case-insensitive substring
    search across skill name, description, and applicable_context.
    If ``query`` is empty, returns the most recently updated skills.

    DESTRUCTIVE-scope skills are included in results regardless of
    their ``approved`` status so operators can review them.

    Args:
        query: Optional search term (e.g. "wash look", "color preset").
        limit: Maximum number of results to return (default 20).
    

Inputs: limit, query. Returns: result

list_system_variablesA
List all grandMA2 built-in system variables (SAFE_READ).

Sends `ListVar` to the console and returns parsed key=value pairs.
System variables include $SELECTEDEXEC, $TIME, $DATE, $VERSION, $HOSTSTATUS,
$FADERPAGE, $BUTTONPAGE, $SELECTEDFIXTURESCOUNT, $USER, $HOSTNAME, etc.

Args:
    filter_prefix: Optional prefix filter (case-insensitive).
        e.g. "SELECTED" returns only $SELECTEDEXEC, $SELECTEDEXECCUE, etc.
        Omit to return all variables.

Returns:
    str: JSON with `variables` dict (name→value), `variable_count`, and `raw_response`.

Inputs: filter_prefix. Returns: result

list_timecode_eventsA
List all Timecode pool objects on the grandMA2 console.

Returns the raw console output of the List Timecode command,
which shows all stored timecode tracks and their slot IDs.

Returns:
    str: JSON with command_sent and raw_response.

Inputs: no named parameters. Returns: result

list_timersA
List all Timer pool objects on the grandMA2 console.

Returns the raw console output of the List Timer command,
which shows all defined countdown / count-up timers.

Returns:
    str: JSON with command_sent and raw_response.

Inputs: no named parameters. Returns: result

list_tool_categoriesB
List auto-discovered tool categories (SAFE_READ).

Returns the ML-generated taxonomy of all MCP tools grouped by
functional similarity.  Categories are discovered via unsupervised
K-Means clustering over hybrid features (structural metadata +
docstring embeddings).

Args:
    category: Optional category name filter (case-insensitive partial match).

Returns:
    str: JSON with categories, tool lists, and clustering metadata.

Inputs: category. Returns: result

list_undo_historyB
Display the undo (Oops) history.

Returns:
    str: JSON with command_sent, raw_response, risk_tier.

Inputs: no named parameters. Returns: result

list_universesA
List DMX universes and their configuration (from LiveSetup/Universes).

Navigates to cd 10 (LiveSetup) -> cd 5 (Universes) -> list -> cd /

Args:
    max_universes: Limit output to first N universes (default 16, max 256).

Returns:
    str: JSON with raw_response, risk_tier.

Inputs: max_universes. Returns: result

list_update_historyB
List programming update history (SAFE_READ).

Shows the recent update log of programmer changes made in the show.

Returns:
    JSON with command_sent and raw_response from the console.

Inputs: no named parameters. Returns: result

list_worldsA
List all World pool objects on the grandMA2 console.

Worlds are used to restrict which fixtures a user can control.
Returns the raw console output of the List World command.

Returns:
    str: JSON with command_sent and raw_response.

Inputs: no named parameters. Returns: result

load_cueA
Pre-load the next or previous cue without executing it (SAFE_WRITE).

LoadNext / LoadPrev arm the cue for Go without firing it.

Args:
    direction: "next" or "prev"
    executor_id: Executor ID to load on (optional)
    sequence_id: Sequence ID to load on (optional)

Returns:
    str: JSON result with command sent

Inputs: direction (required), executor_id, sequence_id. Returns: result

load_showA
Load an existing show file (DESTRUCTIVE — replaces current show).

Args:
    name: Show file name to load.
    confirm_destructive: Must be True to proceed.

Returns:
    str: JSON with command_sent, raw_response, risk_tier.

Inputs: name (required), confirm_destructive. Returns: result

lock_console_uiA
Lock the grandMA2 console UI to prevent accidental input.

Sends the Lock command, which disables all physical panel input
until unlocked. Useful during live shows to prevent accidental
key presses.

Returns:
    str: JSON with command_sent and raw_response.

Inputs: no named parameters. Returns: result

manage_matricksA
Control MAtricks selection patterns via direct command keywords (SAFE_WRITE).

Uses grandMA2 MAtricks command keywords that act directly on the current
fixture selection — no navigation required.

Actions and their parameters:
  - "interleave": Set virtual grid width. Params: value (width), column, increment (+/-), turn_off.
  - "blocks": Set block size. Params: value (size), x, y (x.y notation), increment (+ N/- N), turn_off.
  - "groups": Set align group size. Params: value (size), x, y (x.y notation), increment (+ N/- N), turn_off.
  - "wings": Set wing/mirror parts. Params: value (parts), increment (+/-), turn_off.
  - "filter": Set sub-selection filter. Params: value (filter_num), name (filter name), increment (+/-), turn_off.
  - "reset": Clear all MAtricks settings. No params.
  - "recall": Recall a MAtricks pool object or toggle mode. Params: value (matricks_id), mode (on/off/toggle).
  - "all": Reset Single X sub-selection. No params.
  - "allrows": Reset Single Y sub-selection. No params.
  - "next": Step forward through Single X sub-selection. No params.
  - "previous": Step backward through Single X sub-selection. No params.
  - "nextrow": Step forward through Single Y (row) sub-selection. No params.

Args:
    action: The MAtricks action to perform.
    value: Primary numeric value (width/size/parts/filter_num/matricks_id).
    x: X-axis value for blocks/groups x.y notation.
    y: Y-axis value for blocks/groups x.y notation.
    column: Column for interleave column.width notation.
    increment: Step value: "+", "-", "+ N", or "- N".
    name: Filter name (for action="filter").
    mode: "on", "off", or "toggle" (for action="recall").
    turn_off: Send the "Off" variant of the command.

Returns:
    str: JSON with command_sent, raw_response, risk_tier.

Inputs: action (required), x, y, mode, +5 more. Returns: result

manage_variableA
Set, add to, or list console variables (global or user-scoped).

Variables are named values stored on the console that can be used in
macros and command line expressions. The $ prefix is automatically
added to var_name if not already present.

Args:
    action: "set" to assign a value, "add" to increment, "list" to show all variables
    scope: "global" for system variables, "user" for user-scoped variables
    var_name: Variable name (e.g. "myvar" or "$myvar" — $ auto-added)
    value: Value to set or add. Required for "add", optional for "set",
        ignored for "list"
    input_dialog: If True with action="set", shows an input dialog
        on the console for the user to enter a value

Returns:
    str: JSON with command_sent and raw_response.

Examples:
    - Set global var: action="set", scope="global", var_name="myvar", value=42
    - Set user var: action="set", scope="user", var_name="speed", value=100
    - Add to global: action="add", scope="global", var_name="counter", value=1
    - List global vars: action="list", scope="global"
    - List user vars: action="list", scope="user"

Inputs: scope (required), action (required), var_name (required), value, +1 more. Returns: result

manipulate_selectionA
Invert or Align the current fixture selection / programmer values (SAFE_WRITE).

Invert: swap selected and unselected fixtures.
Align: distribute programmer values evenly from first to last fixture.

Args:
    action: "invert" or "align"

Returns:
    str: JSON result with command sent

Inputs: action (required). Returns: result

master_controlB
Control master faders — set level, set special master, or list all masters.

Args:
    action: "set" (SAFE_WRITE), "set_special" (SAFE_WRITE), or "list" (SAFE_READ)
    master_id: Master pool slot number (required for set / set_special)
    master_type: Special master type number (required for set_special)
    level: Level 0-100 (required for set / set_special)

Returns:
    str: JSON with command_sent, raw_response, risk_tier

Inputs: action (required), level, master_id, master_type. Returns: result

modify_selectionB
Add, remove, replace, or clear the current fixture selection.

Args:
    action: "add" (+ N), "remove" (- N), "replace" (selfix), or "clear"
    fixture_ids: Fixture IDs to add/remove/replace (required for all except "clear")
    end_id: End of a range (optional; builds thru N)

Returns:
    str: JSON result with command sent

Inputs: action (required), end_id, fixture_ids. Returns: result

modulate_effectA
Set rate or speed on active effects in real time (SAFE_WRITE).

Used in busking to live-modulate effect tempo without stopping playback.
Rate is a relative multiplier (100 = normal, 200 = double).
Speed is an absolute BPM target (overrides rate).

Args:
    mode: "rate" (relative 1–200, 100=normal) or "speed" (absolute BPM).
    value: Numeric value for the chosen mode.

Returns:
    JSON result with command sent and console response.

Inputs: mode (required), value (required). Returns: result

new_showA
Create a new empty show (DESTRUCTIVE — replaces current show).

CONNECTIVITY WARNING
--------------------
Creating a new show clears Global Settings, which **disables Telnet login**
and severs the MCP connection.  ``preserve_connectivity=True`` (the default)
automatically adds /globalsettings + /network + /protocols so Telnet stays
enabled and network/DMX config is preserved.

Set ``preserve_connectivity=False`` only if you intend to manually
re-enable Telnet on the console afterwards (Setup → Console → Global
Settings → Telnet → Login Enabled).

Keep flags (correspond to un-checking "Clear …" in the MA2 New Show dialog):

| Flag               | Dialog checkbox          | MA2 flag        | Included by preserve_connectivity |
|--------------------|--------------------------|-----------------|-----------------------------------|
| keep_globalsettings| Clear Global Settings    | /globalsettings | YES — contains Telnet login       |
| keep_network       | Clear Network Config     | /network        | YES — IP / MA-Net2 config         |
| keep_protocols     | Clear Network Protocols  | /protocols      | YES — Art-Net, sACN, etc.         |
| keep_timeconfig    | Clear Time Config        | /timeconfig     | no                                |
| keep_localsettings | Clear Local Settings     | /localsettings  | no                                |
| keep_user          | Clear User Profiles      | /user           | no                                |

Args:
    name: New show file name.
    confirm_destructive: Must be True to proceed.
    preserve_connectivity: Auto-add /globalsettings + /network + /protocols
        to prevent Telnet being disabled (default True).
    keep_timeconfig: Preserve Time Config from current show.
    keep_globalsettings: Preserve Global Settings (overrides preserve_connectivity).
    keep_localsettings: Preserve Local Settings from current show.
    keep_protocols: Preserve Network Protocol settings (overrides preserve_connectivity).
    keep_network: Preserve Network Config (overrides preserve_connectivity).
    keep_user: Preserve User Profiles from current show.

Returns:
    str: JSON with command_sent, raw_response, risk_tier,
         and connectivity_flags listing which flags were applied.

AI assistant guidance
---------------------
Always confirm ``preserve_connectivity=True`` unless the user explicitly
wants a completely clean show AND understands Telnet will be disabled.
Ask about keep_timeconfig, keep_localsettings, keep_user separately —
these have no connectivity impact and are purely about preserving show data.

Inputs: name (required), keep_user, keep_network, keep_protocols, +5 more. Returns: result

normalize_page_fadersA
Set all faders on a page to 0 without releasing executors (SAFE_WRITE).

Silences all effects while keeping them armed for instant recall — the
standard busking blackout technique. Faders return to zero but executors
remain active; pushing the fader up immediately restores the effect.

Args:
    page: Fader page number.
    start_exec: First executor slot (default 1).
    end_exec: Last executor slot (default 20).

Returns:
    JSON result with command count and console response.

Inputs: page (required), end_exec, start_exec. Returns: result

park_fixtureA
Park a fixture or DMX address at its current or specified output value.

Parking locks the output so it won't change when cues or programmer
values change. Useful for testing, worklights, or safety overrides.

Fixture targets are pre-validated: if the fixture does not exist on the
console, the command is not sent and an informative error is returned.
DMX targets (e.g. "dmx 101") bypass pre-validation.

Args:
    target: What to park (e.g. "fixture 20", "dmx 101", "fixture 20 thru 30")
    value: Optional output value to park at (0-255 for DMX, 0-100 for %)

Returns:
    str: JSON with command_sent (None if blocked), raw_response, exists.

Examples:
    - Park fixture 20 at current output: target="fixture 20"
    - Park DMX 101 at 128: target="dmx 101", value=128
    - Park fixture range: target="fixture 20 thru 30"

Inputs: target (required), value. Returns: result

patch_fixtureA
Patch a fixture to a DMX address (DESTRUCTIVE — modifies the patch).

Assigns a DMX address to a fixture. Optionally assigns a fixture type first.

MA2 syntax:
  assign dmx [universe].[address] at fixture [fixture_id]
  assign fixture_type [type_id] at fixture [fixture_id]  (if fixture_type_id given)

Args:
    fixture_id: Fixture ID to patch.
    dmx_universe: DMX universe number (1-256).
    dmx_address: DMX address within universe (1-512).
    fixture_type_id: Fixture type to assign (optional).
    channel_id: Channel ID to assign (optional).
    confirm_destructive: Must be True to proceed.

Returns:
    str: JSON with commands_sent, raw_responses, risk_tier.

Inputs: fixture_id (required), dmx_address (required), dmx_universe (required), channel_id, +2 more. Returns: result

plan_agent_goalA

Generate a plan for a goal WITHOUT executing it.

Useful for previewing what the agent would do before committing.
Returns the parsed goal, generated plan steps, and any policy warnings.

Args:
    goal: Natural language goal to plan for.

Returns:
    str: JSON with intent, plan steps, confidence, and warnings.

Inputs: goal (required). Returns: result

plan_fixture_swapA
Plan a fixture type swap and assess compatibility (SAFE_READ).

Compares attributes between old and new fixture types to identify
what will transfer cleanly and what needs manual attention.

Args:
    old_fixture_type: Current fixture type name (e.g. "Mac 700 Profile").
    new_fixture_type: Target fixture type name (e.g. "Mac Viper").

Returns:
    str: JSON with compatible_attributes, missing_attributes, risk_level, migration_steps.

Inputs: new_fixture_type (required), old_fixture_type (required). Returns: result

playback_actionA
Execute playback operations — go, go back, goto, fast forward/back, etc.

Full-featured playback control with cue_mode and executor targeting.
Coexists with execute_sequence (which uses legacy go_sequence/pause_sequence).

Args:
    action: Playback action to perform:
        "go" — fire the next cue (optionally on a specific executor/sequence)
        "go_back" — fire the previous cue
        "goto" — jump to a specific cue (requires cue_id)
        "fast_forward" — skip forward (>>>)
        "fast_back" — skip backward (<<<)
        "def_go" — go on the selected executor (go+); response includes
                   selected_executor and selected_cue_before
        "def_go_back" / "def_goback" — go back on the selected executor;
                   response includes selected_executor and selected_cue_before
        "def_pause" — pause the selected executor; response includes
                   selected_executor and selected_cue_before
    object_type: Object type for go/go_back (e.g. "executor", "sequence")
    object_id: Object ID for go/go_back — single int or list of ints.
               List produces "N + M + ..." syntax for multi-executor targeting.
    cue_id: Target cue number (required for "goto")
    end: End ID for range (go/go_back)
    cue_mode: Cue execution mode: "normal", "assert", "xassert", "release"
    executor: Executor ID for goto/fast_forward/fast_back — single int or list of ints.
              List produces "N + M + ..." syntax (e.g. [1,2,3] → ">>> executor 1 + 2 + 3").
    sequence: Sequence ID for goto/fast_forward/fast_back

Returns:
    str: JSON with command_sent and raw_response.
         def_go/def_go_back/def_pause also include selected_executor and
         selected_cue_before (read from $SELECTEDEXEC before firing).

Examples:
    - Go on executor 1: action="go", object_type="executor", object_id=1
    - Go on executors 1+2+3: action="go", object_type="executor", object_id=[1,2,3]
    - Go back: action="go_back"
    - Goto cue 5: action="goto", cue_id=5
    - Goto cue 3 on sequence 2: action="goto", cue_id=3, sequence=2
    - Fast forward: action="fast_forward"
    - Fast forward executors 1,2,3: action="fast_forward", executor=[1,2,3]
    - Go on selected executor: action="def_go"
    - Go back on selected executor: action="def_go_back"

Inputs: action (required), end, cue_id, cue_mode, +4 more. Returns: result

plugin_managementA
Manage Lua plugins — list available plugins or reload the plugin pool.

Args:
    action: "list" (SAFE_READ) or "reload" (SAFE_WRITE)

Returns:
    str: JSON with command_sent, raw_response, risk_tier

Inputs: action (required). Returns: result

preview_preset_update_impactA
Assess the impact of updating or deleting a preset (SAFE_READ).

Calls find_preset_usages internally and classifies the risk level.
Run this before any Store, Update, or Delete on a preset.

Args:
    preset_type: Preset type name (e.g. "color", "position").
    preset_id: Preset slot number.

Returns:
    str: JSON with impact_level (safe/risky/catastrophic), affected details, recommendation.

Inputs: preset_id (required), preset_type (required). Returns: result

programming_actionA
Execute programmer operations — align, locate, flip, extract, learn,
block/unblock cue, record macro, store look.

Args:
    action: One of:
        SAFE_WRITE: "align", "locate", "flip", "extract", "learn"
        DESTRUCTIVE: "block", "unblock", "record_macro", "store_look"
    fixture_ids: Fixture number(s) for locate (single int or list)
    end: Ending number for locate range
    cue_id: Cue number for block/unblock
    sequence_id: Sequence ID for block/unblock scoping
    macro_id: Macro pool slot for record_macro
    executor_id: Executor ID for learn
    page: Page for learn page-qualified addressing
    look_id: Look pool slot for store_look
    mode: Alignment mode for align (">" "><" "<>" "<")
    merge: Merge option for store_look
    overwrite: Overwrite option for store_look
    confirm_destructive: Required for block/unblock/record_macro/store_look

Returns:
    str: JSON with command_sent, raw_response, risk_tier

Inputs: action (required), end, mode, page, +9 more. Returns: result

promote_session_to_skillA
    Promote a completed agent session to a named, versioned Skill.

    The skill is stored in the registry with a quality score derived
    from the session's step success ratio.

    Safety rule: if ``safety_scope`` is ``DESTRUCTIVE``, the skill is
    created with ``approved=False`` and cannot be used until an operator
    calls ``approve_skill`` (requires SYSTEM_ADMIN scope).

    Args:
        session_id:        ID of the session to promote (8-char prefix or full UUID).
        name:              Short human name for the skill (e.g. "blue_wash_look").
        description:       One-line purpose statement.
        body:              Markdown playbook — steps, caveats, example inputs.
        safety_scope:      "SAFE_READ" | "SAFE_WRITE" | "DESTRUCTIVE"  (default SAFE_WRITE).
        applicable_context: Free-text retrieval hint (e.g. "color wash cue storage").
    

Inputs: body (required), name (required), session_id (required), description (required), +2 more. Returns: result

query_object_listA
List objects from the show file by type — cues, groups, presets, etc.

Sends typed `list <type>` commands with type-specific options.
Different from list_console_destination (which lists at the current
navigation location). This tool queries named object pools directly.

Args:
    object_type: Object type to list. Typed shortcuts:
        "cue", "group", "preset", "attribute", "messages".
        Or any generic type (e.g. "sequence", "macro", "executor").
        If omitted, lists all objects at the default scope.
    object_id: Optional object ID to list a specific item
    end: Optional end ID for range listing (e.g. cue 1 thru 10)
    sequence_id: Sequence to list cues from (only for object_type="cue")
    preset_type: Preset type name or number (only for object_type="preset",
        e.g. "color", "position", "4")
    filename: Optional filename to export the list output
    condition: Optional filter condition (for "messages" or generic types)

Returns:
    str: JSON with command_sent and raw_response.

Examples:
    - List all cues: object_type="cue"
    - List cues in sequence 2: object_type="cue", sequence_id=2
    - List groups: object_type="group"
    - List color presets: object_type="preset", preset_type="color"
    - List attributes: object_type="attribute"

Inputs: end, filename, condition, object_id, +3 more. Returns: result

rdm_discoverA
Perform RDM device discovery on the grandMA2 console.

Actions:
- "automatch"  : Match discovered RDM devices to existing fixture types (RdmAutomatch).
- "autopatch"  : Auto-patch discovered RDM devices to free DMX addresses (RdmAutopatch).

RDM (Remote Device Management) allows two-way communication with
DMX fixtures that support the RDM protocol.

Args:
    action: "automatch" or "autopatch" (default: "automatch").

Returns:
    str: JSON with command_sent and raw_response.

Inputs: action. Returns: result

rdm_get_infoA
Query RDM device information from the grandMA2 console.

- If fixture_id is provided: returns RDM device info for that fixture (RdmInfo Fixture N).
- If universe is provided (and no fixture_id): lists RDM devices on that universe (RdmList Universe N).
- If neither is provided: lists all discovered RDM devices (RdmList).

Args:
    fixture_id: Fixture ID to query (optional).
    universe: Universe number to filter by (optional).

Returns:
    str: JSON with command_sent and raw_response.

Inputs: universe, fixture_id. Returns: result

rdm_patchA
Patch or unmatch an RDM device on the grandMA2 console.

Actions:
- "setpatch" : Assign the RDM device at fixture_id to a specific DMX address.
               Requires universe and address.
- "unmatch"  : Detach the RDM match for a fixture (RdmUnmatch Fixture N).

Args:
    fixture_id: Fixture ID of the RDM device.
    action: "setpatch" or "unmatch".
    universe: Target universe number (required for setpatch).
    address: Target DMX address 1-512 (required for setpatch).
    confirm_destructive: Must be True to proceed. Defaults to False (blocked).

Returns:
    str: JSON with command_sent and raw_response.

Inputs: action (required), fixture_id (required), address, universe, +1 more. Returns: result

recall_agent_sessionA
    Restore the full WorkingMemory snapshot from a past agent session.

    Args:
        session_id: 8-char session ID from list_agent_sessions
    

Inputs: session_id (required). Returns: result

recluster_toolsA
Trigger re-clustering of all MCP tools (SAFE_READ).

Runs the full ML pipeline: extract features from tool definitions,
embed docstrings, cluster via K-Means, and regenerate the taxonomy.

Args:
    provider: Embedding provider — "zero" (fast stub) or "github"
              (real embeddings, requires GITHUB_MODELS_TOKEN).
    k: Override number of clusters.  None = auto-select via silhouette.
    alpha: Structural feature weight (0–1). Embedding weight = 1 − alpha.

Returns:
    str: JSON summary with categories, silhouette score, and tool assignments.

Inputs: k, alpha, provider. Returns: result

reconfigure_connectionA

Swap the active console connection and (optionally) persist to .env.

Atomic swap: rebuilds the SessionManager under the manager lock so in-flight
tool calls either complete on the old manager or fail with ConnectionError
(operator-recoverable). With ``verify=True`` (default), a fresh client is
opened against the candidate host and ``ListVar`` is executed before any
swap; failure aborts the call and leaves the previous connection intact.

Args:
    host: New console host (IPv4 or hostname).
    port: Telnet port (default 30000).
    user: Console user.
    password: Console password.
    persist: When True, also write GMA_HOST/GMA_PORT/GMA_USER/GMA_PASSWORD to
        .env so the next server start uses them (default False: this run only).
    verify: When True, run a SAFE_READ probe before committing the swap.
        With False the reply says ``verified: false``. To just free the
        console, use disconnect_console instead of pointing at a dummy host.

Returns:
    JSON envelope: ``{success, previous_host, new_host, verified, persisted_to,
    note, warning, error}``.

Inputs: host (required), port, user, verify, +2 more. Returns: result

register_decomposition_ruleA
    Register a new task decomposition rule at runtime (admin only).

    Args:
        pattern:    Regex pattern matched against natural-language goals
        steps_json: JSON array of step dicts with keys:
                    name, agent_role, description,
                    allowed_risk (SAFE_READ|SAFE_WRITE|DESTRUCTIVE),
                    mcp_tools (array), depends_on (array), eval_criteria
    

Inputs: pattern (required), steps_json (required). Returns: result

release_executorC
Release an executor, returning it to its default state.

Args:
    executor_id: Executor ID (1-999).
    page: Page number for page-qualified addressing (optional).

Returns:
    str: JSON with command_sent, raw_response, risk_tier.

Inputs: executor_id (required), page. Returns: result

reload_all_pluginsA
Reload all plugins from disk on the grandMA2 console.

Sends ReloadPlugins, which rescans the plugin folder and reloads
all Lua plugin files. Use after editing plugin files on disk.

Args:
    confirm_destructive: Must be True to proceed. Defaults to False (blocked).

Returns:
    str: JSON with command_sent and raw_response.

Inputs: confirm_destructive. Returns: result

remap_fixture_idsA
Remap fixture references from one fixture ID to another within groups or presets.

Used after PSR import or cross-venue adaptation when imported cue data references
fixture IDs that have changed in the current rig. Updates group membership and/or
selective preset fixture references.

DESTRUCTIVE — modifies show data. Use check_pool_slot_availability and
list_fixtures first to confirm both fixture IDs exist in the current patch.

Args:
    source_fixture_id: The old fixture ID to replace.
    target_fixture_id: The new fixture ID to use.
    scope: "groups" (update group membership only), "presets" (update selective
           preset references only), or "both".
    confirm_destructive: Must be True to execute.

Returns JSON with:
- remapped_objects: list of modified pool objects
- skipped: list of objects where source_fixture_id was not found
- command_log: commands sent to console

Inputs: source_fixture_id (required), target_fixture_id (required), scope, confirm_destructive. Returns: result

remove_contentA
Remove content from objects (fixtures from groups, effects, preset types, etc.).

Unlike delete (which removes the object itself), remove takes content out of
an object. For example, removing a fixture from a group, or removing an effect
from a cue.

SAFETY: This is a DESTRUCTIVE operation. Requires confirm_destructive=True.

Args:
    object_type: What to remove. Special types:
        "selection" — remove the current selection
        "fixture" — remove a fixture (from a group, cue, etc.)
        "effect" — remove an effect
        "presettype" — remove a preset type from the programmer
        Or any generic type for the generic remove command.
    object_id: Object ID to remove (not needed for "selection")
    end: End ID for range removal
    if_filter: Conditional filter (e.g. "PresetType 1")
    confirm_destructive: Must be True to execute (safety gate)

Returns:
    str: JSON with command_sent, raw_response, or block info.

Examples:
    - Remove selection: object_type="selection"
    - Remove fixture 1: object_type="fixture", object_id=1
    - Remove fixture with filter: object_type="fixture", object_id=1,
      if_filter="PresetType 1"
    - Remove effect 1: object_type="effect", object_id=1
    - Remove preset type: object_type="presettype", object_id="position"

Inputs: object_type (required), end, if_filter, object_id, +1 more. Returns: result

remove_from_programmerB
Remove channels, fixtures, or a group from the programmer using Off.

Args:
    object_type: "channel", "fixture", or "group"
    object_id: Object ID to remove
    end_id: End of range for channel/fixture (optional; builds thru N)

Returns:
    str: JSON result with command sent

Inputs: object_id (required), object_type (required), end_id. Returns: result

renumber_fixturesA
Plan renumbering of out-of-block fixtures into their category's 100-block (PLAN-ONLY).

Re-reads the patch fresh (never acts on a stale model) and computes the
renumbering plan from verify_fixture_id_blocks. This tool NEVER executes:
fixture IDs cannot be changed over telnet — live-verified 2026-07-17
(v3.9.60.50): ``Assign Fixture <old> /fixid=<new>`` and every
property-assign variant (FixId/ChaId at root, in the EditSetup and
LiveSetup layer contexts, and via ``Move``) return Error #66 CANNOT
ASSIGN, while sibling properties like ``/name=`` apply fine — the FixId
column is console-side read-only. Renumbering must be done by the
operator in Setup → Patch & Fixture Schedule; the returned ``commands``
are manual dialog steps.

Args:
    dry_run: Retained for API compatibility; every call is a dry run.
    confirm_destructive: Retained for API compatibility; execution is
        never possible, so this flag has no effect.

Returns:
    str: JSON with renumber_plan, commands (manual operator steps),
    executed (always 0), plan_only, blocked, risk_tier.

Inputs: dry_run, confirm_destructive. Returns: result

resolve_object_refA
    Resolve a pool object name or ID to a correctly-quoted MA2 command token.
    Uses in-memory index only — zero telnet cost.

    match_mode="literal" (default): quotes names with special chars; * is literal.
    match_mode="wildcard": * is active operator — may match multiple objects.

    Args:
        object_type: Group | Sequence | Preset | Macro | Effect | Timecode |
                     Timer | View | Layout | World | Filter | Page |
                     Executor | Fixture | Channel | Cue
        name:        Display name (use name OR id, not both)
        id:          Numeric ID (0 = not provided)
        match_mode:  "literal" (default) or "wildcard"
        preset_type: Required for Preset objects (1=Dimmer … 9=Video)
    

Inputs: object_type (required), id, name, match_mode, +1 more. Returns: result

restore_programmer_stateA
Preview or apply a conservative programmer-state restore (SAFE_WRITE).

This tool intentionally restores only fields that can be expressed
confidently through existing MA2 telnet commands. It does not attempt to
recreate exact fixture selections, parked-fixture state, or MAtricks.

Args:
    snapshot_json: JSON payload from snapshot_programmer_state().
    apply: If False (default), return the restore plan only.
    clear_before_restore: If True, begin with ClearAll when apply=True.

Returns:
    str: JSON with planned commands, executed commands, and skipped fields.

Inputs: snapshot_json (required), apply, clear_before_restore. Returns: result

retry_failed_stepsA
    Retry all failed steps from a prior task session.

    Loads the session from long-term memory, retrieves its original goal,
    and re-executes the task via run_task. Returns the retry outcome.

    This is a full re-run of the original goal, not a selective step replay.
    For selective step control, use decompose_task + run_task directly.

    Args:
        session_id: 8-char session ID from list_agent_sessions.

    Returns:
        str: JSON with retried, session_id, original_goal, new_session_id,
             failed_steps_before, outcome.
    

Inputs: session_id (required). Returns: result

run_agent_goalA

Execute a high-level production goal using the agent runtime.

The agent runtime decomposes the goal into a sequenced plan, validates
it against safety policies, executes steps with verification, and
produces a structured execution trace.

SAFETY: Destructive steps require confirmation. Set auto_confirm=True
to skip confirmation prompts (use with caution).

Args:
    goal: Natural language goal, e.g. "Patch 8 Mac 700 fixtures
        starting at address 1.001 and assign to executor 1"
    auto_confirm: If True, auto-confirm all destructive steps.
        If False (default), destructive steps remain blocked unless
        the runtime can obtain an explicit confirmation callback.
    dry_run: If True, generate and validate the plan but do NOT
        execute it. Returns the plan and policy warnings.

Returns:
    str: JSON execution trace with goal, plan, steps, result,
        and timing information.

Examples:
    - "List all groups" → discovery workflow
    - "Patch 4 Mac 700 fixtures at 1.001" → patch workflow
    - "Create a color preset for group 1" → preset workflow

Inputs: goal (required), dry_run, auto_confirm. Returns: result

run_command_batchA
Run many raw MA commands in order on one held connection (DESTRUCTIVE if any line is).

Every line (and every ';'-part of a line) is risk-classified before anything
is sent; if any is DESTRUCTIVE the whole batch needs confirm_destructive=True.
Each command waits for its own console prompt, so batches run far faster than
one send_raw_command call per line. Stops at the first console error or
pop-up unless stop_on_error=False (a pop-up always stops the batch).

Args:
    commands: Command lines to send, in order.
    commands_file: Path to a .txt/.cmd/.ma2/.macro file, one command per
        line; blank lines and lines starting with '#' are skipped.
    confirm_destructive: Required when any line is DESTRUCTIVE.
    stop_on_error: Stop at the first rejected command (default True).
    delay: Seconds to wait after each send before reading (default 0).
    timeout: Seconds to wait for each command's first output.

Returns:
    str: JSON summary — total, executed, failed (line, command, errors),
        stopped_early, duration_s, last_reply.

Inputs: delay, timeout, commands, commands_file, +2 more. Returns: result

run_lua_scriptA
Execute an inline Lua script directly on the grandMA2 console.

Sends the script using the Lua keyword. Useful for one-off
automations without creating a persistent Plugin pool entry.

Args:
    script: Lua source code (e.g. 'print("hello")', 'gma.cmd("Blackout")').
    confirm_destructive: Must be True to proceed. Defaults to False (blocked).

Returns:
    str: JSON with command_sent and raw_response.

Inputs: script (required), confirm_destructive. Returns: result

run_macroB
Execute a macro by its ID number.

Macros are stored command sequences on the console. This triggers
the macro to run.

Args:
    macro_id: Macro number to execute

Returns:
    str: JSON with command_sent and raw_response.

Examples:
    - Run macro 1: macro_id=1
    - Run macro 99: macro_id=99

Inputs: macro_id (required). Returns: result

run_preset_pluginA
Orchestrate a preset/color-picker plugin run end-to-end (DESTRUCTIVE).

Pipeline: (1) resolve the plugin in the pool; (2) verify preconditions
from its manifest — required groups exist, declared pool ranges are free;
(3) build the type-ordered fixture selection the plugin expects;
(4) run the plugin; (5) diff the output pools and report what was created.

Manifests for known plugins ship in src/plugin_manifests.py (e.g.
"auto-layout-color-picker"); pass manifest_overrides to adjust pool
ranges or required groups per show, or to describe an unknown plugin.

Args:
    plugin_name: Plugin pool name or builtin manifest key.
    manifest_overrides: Optional dict overriding manifest fields
        (pool_ranges, required_groups, selection, outputs).
    dry_run: When True (default) run only phases 1-3 and report the plan.
    confirm_destructive: Must be True to execute with dry_run=False.

Returns:
    str: JSON with plugin, preconditions, selection_commands, executed,
    outputs_created (per pool diff), blocked, risk_tier.

Inputs: plugin_name (required), dry_run, manifest_overrides, confirm_destructive. Returns: result

run_taskA
    Execute a full rule-based orchestration task from a natural-language goal.

    Orchestrates sub-agents with risk-tier isolation, working memory,
    and per-step evaluation.

    For the richer agent harness in src/server.py, prefer run_agent_goal.

    Args:
        goal: Natural-language show intent
        auto_confirm_destructive: Set True to allow DESTRUCTIVE steps
            without manual confirmation. Default False for safety.
    

Inputs: goal (required), cue, color, group, +3 more. Returns: result

save_recall_viewA
Store, recall, or label a screen view (store is DESTRUCTIVE).

Args:
    action: "store" (save current screen), "recall" (load view), or "label" (name it)
    view_id: View slot ID (1-10)
    screen_id: Screen number (1-4, default 1)
    view_name: Label for the view (required for action="label")
    confirm_destructive: Must be True for action="store"

Returns:
    str: JSON result with command sent

Inputs: action (required), view_id (required), screen_id, view_name, +1 more. Returns: result

save_showA
Save the current show file to disk.

Args:
    action: "save" (overwrite current) or "saveas" (save under a new name).
        Giving show_name implies "saveas".
    show_name: Show name (required for action="saveas")

Returns:
    str: JSON result with command sent. Saving over an existing file may
        open an overwrite pop-up — reported as pending_popup.

Inputs: action, show_name. Returns: result

scan_console_indexesA
Scan numeric indexes via cd N → list → cd <reset_to>.

For each index N from 1 to max_index:
  1. cd N           — navigate into that index
  2. list           — enumerate children there
  3. cd <reset_to>  — return to the base location for the next iteration

The reset_to destination controls what each cd N is relative to:
  - "/"          (default) scan root-level indexes (Showfile, TimeConfig, …)
  - "Sequence"   reset to Sequence pool → cd N enters Sequence N → list shows its cues
  - "Group"      reset to Group pool → cd N enters Group N

Stops early after stop_after_failures consecutive indexes with no entries.

Args:
    reset_to: Where to navigate after each list before the next cd N (default "/").
    max_index: Highest index to try (default 50).
    stop_after_failures: Stop after this many consecutive empty indexes (default 3).

Returns:
    str: JSON with a list of scan results — one entry per index that
         returned list output, each with index, location, object_type,
         and parsed entries (object_type, object_id, name).

Inputs: reset_to, max_index, stop_after_failures. Returns: result

scan_page_executor_layoutA
Scan a range of executors on a page and return their slot occupancy map (SAFE_READ).

Queries each executor in the range via 'List Executor page.id' (KEY=VALUE format),
extracts Name, Sequence, and Width. Builds an occupancy map showing which consecutive
slots are blocked by wide executors, and lists free slots.

Use this BEFORE setting width on an executor to confirm the adjacent slot is free.
A width=2 executor at slot N blocks slot N+1; the console will silently fail or wrap
if N+1 is already occupied.

Args:
    page: Page number to scan (default 1).
    executor_id_start: First executor ID to check (default 201).
    executor_id_end: Last executor ID to check (default 240).

Returns:
    str: JSON with:
      - executors: list of {id, name, sequence, width, slots_occupied}
      - blocked_slots: set of slot IDs consumed by multi-wide executors
      - free_slots: slot IDs in range with no assignment

Inputs: page, executor_id_end, executor_id_start. Returns: result

search_codebaseA

Search source code, grandMA2 docs, and MCP SDK source using the RAG index.

Three indexed knowledge sources (repo_refs):
- "worktree"     — this server's Python source, tests, and docs
- "ma2-help-docs" — ~1,043 grandMA2 help pages from help.malighting.com
- "mcp-sdk"      — installed MCP SDK source (~110 files, types, server, tools)

Works without any API key (text-search fallback). With GITHUB_MODELS_TOKEN
set, results are ranked by semantic similarity.

Args:
    query:  Natural language or keyword query (e.g. "navigate console",
            "store preset", "how to patch fixtures", "mcp tool context")
    top_k:  Number of results to return (default 8, max 20)
    kind:   Optional filter — one of: "source", "test", "doc", "config"

Returns:
    JSON array of matching chunks with path, kind, lines, score, and text.
    Returns an error JSON if the RAG index has not been built yet.

Examples:
    - Find command builders:   query="store preset", kind="source"
    - Find grandMA2 docs:      query="how to patch fixtures", kind="doc"
    - Find MCP SDK internals:  query="mcp tool decorator context"
    - Search everything:       query="effects engine"
    - Find test examples:      query="navigate_console", kind="test"

Inputs: query (required), kind, top_k. Returns: result

select_executorA
Select an executor on the console.

IMPORTANT: MA2 telnet 'select executor N' is single-selection only — there
is no list syntax. You cannot select multiple executors simultaneously via
this command. Pass only a single executor_id integer.

After sending the command, $SELECTEDEXEC is read back to confirm the
selection took effect. A 'warning' field is included in the response if
the confirmed value does not match the requested executor_id.

To clear the current selection, pass deselect=True. This sends a bare
'select' command with no argument. NOTE: bare 'select' behaviour is
unverified on grandMA2 telnet — it may clear selection, be silently
ignored, or produce an error. Inspect 'raw_response' to confirm.

Args:
    executor_id: Executor number (1-999). Single value only.
    page: Page number for page-qualified addressing (optional).
          e.g. page=2, executor_id=5 → 'select executor 2.5'.
          $SELECTEDEXEC returns the executor number only (not page-qualified).
    deselect: If True, send bare 'select' to clear the current selection
              instead of selecting executor_id. Defaults to False.

Returns:
    str: JSON with command_sent, raw_response, confirmed_selected_exec,
         and risk_tier. Includes 'warning' if confirmed value doesn't match.

Inputs: executor_id (required), page, deselect. Returns: result

select_featureA
Select the active feature bank on the grandMA2 console (SAFE_WRITE).

Sends `Feature [name]` which updates $FEATURE.
$FEATURE is read-only — SetVar has no effect on it.
Only `Feature [name]` changes the active feature context.

Feature names are fixture-dependent — only features present on the selected
fixture's channels are valid. Live-verified names (v3.9.60.65):
  Dimmer, Position, Gobo1, Gobo2, ColorRGB, Shutter, Focus, MSPEED
Names that may error if fixture lacks the channel: Color, Zoom, Iris, Frost

Args:
    feature_name: Feature bank to activate (e.g. "Dimmer", "ColorRGB", "MSPEED")

Returns:
    str: JSON with command_sent, raw_response, risk_tier

Inputs: feature_name (required). Returns: result

select_fixtures_by_groupA
Select all fixtures in a group (replaces or appends to current selection).

Args:
    group_id: Group ID to select (1-999)
    append: If True, adds group to current selection instead of replacing

Returns:
    str: JSON result with command sent

Inputs: group_id (required), append. Returns: result

select_fixtures_by_type_orderA
Build (and optionally execute) a type-ordered fixture selection (SAFE_WRITE).

Emits one additive ``Fixture <ranges>`` command per fixture type, in
canonical category order (wash, mover, bar, strobe, blinder,
conventional, other) or a custom order — so the console's selection
order matches fixture-type order, which is what preset/color-picker
plugins require at runtime. Works even when ID blocks are dirty.

Args:
    order: Optional custom category order (subset of the canonical list).
    execute: When True, send the commands to the console; when False
        (default) return them for embedding in a macro or workflow.
    clear_first: Prepend ClearAll so selection order is deterministic.

Returns:
    str: JSON with commands, executed, selection_order (types in emission
    order), risk_tier.

Inputs: order, execute, clear_first. Returns: result

select_preset_typeA
Select the active preset type on the grandMA2 console (SAFE_WRITE).

Sends `PresetType [id or name]` which jumps the encoder context to the
first Feature available in that preset type for the selected fixtures.
Updates $PRESET, $FEATURE, and $ATTRIBUTE simultaneously.

CD tree location (live-verified, v3.9.60.65):
  cd 10.2        → lists all 9 PresetTypes
  cd 10.2.N      → lists Features under PresetType N
  cd 10.2.N.M    → lists Attributes under Feature M of PresetType N
  cd 10.2.N.M.K  → lists SubAttributes (deepest level)

Preset types + live-verified $FEATURE on first activation:
  1=Dimmer  ($FEATURE=DIMMER,   $ATTRIBUTE=DIM)
  2=Position ($FEATURE=POSITION, $ATTRIBUTE=PAN)
  3=Gobo    ($FEATURE=GOBO1,    $ATTRIBUTE=GOBO1)
  4=Color   ($FEATURE=COLORRGB, $ATTRIBUTE=COLORRGB1, fixture-dep)
  5=Beam    ($FEATURE=SHUTTER,  $ATTRIBUTE=SHUTTER,   fixture-dep)
  6=Focus   ($FEATURE=FOCUS,    $ATTRIBUTE=FOCUS)
  7=Control ($FEATURE=MSPEED,   $ATTRIBUTE=INTENSITYMSPEED)
  8=Shapers (fixture must have Shapers channels)
  9=Video   (fixture must have Video channels)

Args:
    preset_type: Preset type number (1-9) or name (e.g. "Color", "Control")

Returns:
    str: JSON with command_sent, raw_response, risk_tier

Inputs: preset_type (required). Returns: result

send_oscA
Send an OSC message to an external application like Resolume Arena (SAFE_WRITE).

Uses raw UDP — no extra dependencies. Works with any OSC-compatible software:
Resolume Arena/Avenue, QLab, TouchDesigner, Ableton, etc.

Common Resolume OSC addresses:
  /composition/tempocontroller/tempo  — set BPM (float)
  /composition/layers/N/clips/M/connect — trigger clip (int 1)
  /composition/layers/N/video/opacity — layer opacity (float 0.0-1.0)
  /composition/disconnectall — clear all clips (int 1)

Args:
    address: OSC address pattern (e.g. "/composition/tempocontroller/tempo").
    value: Value to send — float, int, or string.
    host: Target host (default "localhost").
    port: Target OSC port (default 7000, Resolume's default).

Returns:
    str: JSON with address, value, host, port, status.

Examples:
    - Set Resolume BPM: send_osc(address="/composition/tempocontroller/tempo", value=128.0)
    - Trigger clip: send_osc(address="/composition/layers/1/clips/1/connect", value=1)
    - Layer opacity: send_osc(address="/composition/layers/1/video/opacity", value=0.75)

Inputs: value (required), address (required), host, port. Returns: result

send_raw_commandA
Send a raw MA command to grandMA2 and return the console response.

WARNING: This is a low-level tool that sends commands directly to a LIVE
lighting console. Prefer the higher-level tools (create_fixture_group,
execute_sequence) whenever possible.

SAFETY: Commands are classified by risk tier before sending:
- SAFE_READ (list, info, cd): Always allowed
- SAFE_WRITE (at, go, clear, blackout): Allowed in standard and admin mode
- DESTRUCTIVE (delete, store, assign, shutdown): Blocked unless
  confirm_destructive=True. Set GMA_SAFETY_LEVEL=admin to skip checks.

Args:
    command: Raw MA command to send
    confirm_destructive: Must be True to send destructive commands
        (delete, store, assign, shutdown, newshow, etc.)

Returns:
    str: JSON with command_sent, risk_tier, raw_response, and any
        safety block information.

Examples:
    - go+ executor 1.1
    - list cue
    - store sequence 1 cue 1 (requires confirm_destructive=True)

Inputs: command (required), confirm_destructive. Returns: result

set_attributeA
Set a specific fixture attribute (Pan, Tilt, Zoom, etc.) to a value.

Controls individual fixture parameters beyond simple dimmer intensity.
Optionally select fixtures/group first.

Args:
    attribute_name: Attribute name (e.g. "Pan", "Tilt", "Zoom", "Focus", "Iris")
    value: Attribute value (typically 0-100 for percentage, or degrees for Pan/Tilt)
    fixture_id: Optional fixture to select first (single or range start)
    fixture_end: Optional end fixture for range selection
    group_id: Optional group to select first

Returns:
    str: JSON with commands_sent and raw_response.

Examples:
    - Set Pan to 120: attribute_name="Pan", value=120
    - Set Tilt to 50 on group 2: attribute_name="Tilt", value=50, group_id=2
    - Set Zoom on fixtures 1-10: attribute_name="Zoom", value=80, fixture_id=1, fixture_end=10

Inputs: value (required), attribute_name (required), group_id, fixture_id, +1 more. Returns: result

set_bpmA
Set the BPM on a grandMA2 Speed Master (SAFE_WRITE).

Designed for live BPM sync from external sources like ShowKontrol,
Beat Link Trigger, Ableton, or any system that provides real-time BPM.
Sends the SpecialMaster command to the console via Telnet.

The BPM value directly controls effect speed for any executor assigned
to this speed master. Common workflow: ShowKontrol reads CDJ BPM →
calls this tool → MA2 effects follow the DJ's tempo in real time.

Args:
    bpm: Beats per minute (1-300). Fractional values supported (e.g. 128.5).
    speed_master: Which speed master to control (1-16, default 1).

Returns:
    str: JSON with command_sent, raw_response, bpm, speed_master.

Examples:
    - Set 128 BPM on speed master 1: set_bpm(bpm=128)
    - Set 140 BPM on speed master 3: set_bpm(bpm=140, speed_master=3)

Inputs: bpm (required), speed_master. Returns: result

set_cue_timingA
Set fade and/or delay time on a specific cue (DESTRUCTIVE).

Args:
    cue_id: Cue number to update
    confirm_destructive: Must be True to execute
    sequence_id: Sequence ID for scoping (optional)
    fade_time: Fade time in seconds (0.0–3600.0, optional)
    delay_time: Delay time in seconds (0.0–3600.0, optional)

Returns:
    str: JSON result with commands sent

Inputs: cue_id (required), fade_time, delay_time, sequence_id, +1 more. Returns: result

set_effect_paramA
Set an effect parameter in the programmer for the current fixture selection.

Valid parameters: bpm, hz, high, low, phase, width, attack, decay.

- bpm / hz   : Effect speed (beats per minute or Hertz)
- high / low : Upper and lower value limits (0-100)
- phase      : Phase offset (0-359 degrees)
- width      : Pulse width (0-100)
- attack     : Attack time (0-100)
- decay      : Decay time (0-100)

Args:
    param: Parameter name (case-insensitive). One of: bpm, hz, high, low,
           phase, width, attack, decay.
    value: Numeric value appropriate for the parameter.

Returns:
    str: JSON with command_sent and raw_response.

Inputs: param (required), value (required). Returns: result

set_executor_levelB
Set a fader/executor to a specific output level.

Args:
    executor_id: Executor number (1-999)
    level: Fader level 0.0–100.0
    page: Page number for page-qualified addressing (optional)

Returns:
    str: JSON result with command sent

Inputs: level (required), executor_id (required), page. Returns: result

set_executor_priorityA
Set the playback priority of an executor (Tool 130).

Priority determines how this executor interacts with other active executors
and the programmer. Uses page-qualified addressing (page.executor_id) to
avoid Error #66 CANNOT ASSIGN.

Priority levels (highest → lowest):
  - "super"  — LTP above ALL playbacks + programmer. Only Freeze overrides.
  - "swap"   — LTP > HTP; negative override possible. Affects ALL attributes.
  - "htp"    — Highest intensity value wins. Changes ALL attribute priority.
  - "high"   — High LTP. Overrides Normal/Low but not HTP intensity.
  - "normal" — LTP default. Last triggered value wins.
  - "low"    — Lowest priority. Overridden by everything else.

Args:
    executor_id: The executor to modify (e.g. 201).
    priority: One of "super", "swap", "htp", "high", "normal", "low".
    page: Page number (default 1). Always included in the address.

Returns:
    str: JSON with command_sent, raw_response, risk_tier.

Inputs: priority (required), executor_id (required), page. Returns: result

set_fixture_type_propertyA
Set a property on a fixture type in LiveSetup (DESTRUCTIVE).

Navigates to LiveSetup/FixtureTypes/[N] and assigns a property value.
Path: cd 10 -> cd 3 -> assign [fixture_type_id]/property=value -> cd /

Args:
    fixture_type_id: Fixture type index (1-based).
    property_name: Property to set (e.g. "Mode", "Name").
    value: New value for the property.
    confirm_destructive: Must be True to proceed.

Returns:
    str: JSON with commands_sent, success, risk_tier.

Inputs: value (required), property_name (required), fixture_type_id (required), confirm_destructive. Returns: result

set_intensityA
Set the intensity (dimmer) level on fixtures, groups, or channels.

This is the most fundamental lighting operation — controlling how bright
lights are. Selects the target and sets it to the specified percentage.

Args:
    target_type: Object type — "fixture", "group", or "channel"
    target_id: Object ID number
    level: Intensity percentage (0-100). Use 0 for off, 100 for full.
    end_id: End ID for range selection (e.g., fixture 1 thru 10)

Returns:
    str: JSON with command_sent and raw_response from the console.

Examples:
    - Set fixture 1 to 50%: target_type="fixture", target_id=1, level=50
    - Set group 3 to full: target_type="group", target_id=3, level=100
    - Set fixtures 1-10 to 75%: target_type="fixture", target_id=1, level=75, end_id=10

Inputs: level (required), target_id (required), target_type (required), end_id. Returns: result

set_node_propertyA
Set a property on a node in the grandMA2 object tree (DESTRUCTIVE).

Uses the scan tree path notation (dot-separated indexes) to navigate
to a node and set an inline property using Assign [index]/property=value.

The path uses the same index-based notation as the scan tree output.
Split the path into parent segments and target index:
- "3.1" → cd 3 (Settings), then Assign 1/property=value (on Global)
- "4.1" → cd 4 (DMX_Protocols), then Assign 1/property=value (on Art-Net)
- "3" → at root, Assign 3/property=value (on Settings itself)

After setting, navigates back to root (cd /).
If verify=True (default), re-lists and confirms the property changed.

SAFETY: This modifies live console state. Requires confirm_destructive=True.

Args:
    path: Dot-separated index path (e.g. "3.1" for Settings/Global)
    property_name: Property to set (e.g. "Telnet", "OutActive")
    value: New value (e.g. "Login Enabled", "On")
    verify: Re-list after setting to confirm the change (default True)
    confirm_destructive: Must be True to execute (DESTRUCTIVE operation)

Returns:
    str: JSON with commands_sent, success, verified_value, and any errors.

Examples:
    - Set telnet to disabled: path="3.1", property_name="Telnet", value="Login Disabled"
    - Enable Art-Net output: path="4.1", property_name="OutActive", value="On"

Inputs: path (required), value (required), property_name (required), verify, +1 more. Returns: result

set_sequence_propertyA
Set a property on a sequence object via the console tree (DESTRUCTIVE).

Navigates to the sequence node, assigns the property, then returns to root.

Args:
    sequence_id: Sequence ID (1-999)
    property_name: Property name (e.g. "loop", "tracking", "label")
    value: Property value (e.g. "on", "off", "My Sequence")
    confirm_destructive: Must be True to execute

Returns:
    str: JSON result with commands sent

Inputs: value (required), sequence_id (required), property_name (required), confirm_destructive. Returns: result

snapshot_console_baselineA
Snapshot a console-state baseline for divergence detection (SAFE_READ).

Records a cheap fingerprint of the console — showfile, user, page
counters, selected executor, and the ID sets of the group/sequence/
macro/world/filter pools. Call this at the start of a working session
(or before handing the desk to another operator); later, call
detect_console_divergence to see what changed outside this MCP session.

Returns:
    str: JSON with the recorded baseline and captured_at timestamp.

Inputs: no named parameters. Returns: result

snapshot_programmer_stateA
Capture a structured programmer-state snapshot for later review (SAFE_READ).

Returns:
    str: JSON with a restorable snapshot subset plus non-restorable context.

Inputs: no named parameters. Returns: result

store_agendaA
Create (store) a new Agenda pool object on the grandMA2 console. (DESTRUCTIVE)

Agendas are time-triggered events (clock/sunrise/sunset) that fire macros or
cues automatically. After storing, use the assign tool to attach a macro trigger.

The store command creates the pool slot. To add time triggers to an existing
agenda, use store_timecode_event with object_type="agenda".

Args:
    agenda_id: Agenda slot number (1-256)
    name: Optional label applied immediately after store
    confirm_destructive: Must be True to execute

Returns:
    str: JSON with commands_sent and raw_responses.

Inputs: agenda_id (required), name, confirm_destructive. Returns: result

store_cue_with_timingA
Store a cue with inline fade and outtime parameters (DESTRUCTIVE).

When sequence_id is omitted, MA2 stores into the sequence on the currently
selected executor. Pass sequence_id explicitly to target a specific sequence
regardless of executor selection state (same behavior as store_current_cue).

Args:
    cue_id: Cue number to store
    confirm_destructive: Must be True to execute
    fade_time: Fade-in time in seconds (optional)
    out_time: Fade-out time in seconds (optional)
    merge: Merge into existing cue
    overwrite: Overwrite existing cue
    cue_name: Optional cue label
    sequence_id: Sequence to store into (omit to use selected executor)

Returns:
    str: JSON result with command sent

Inputs: cue_id (required), merge, cue_name, out_time, +4 more. Returns: result

store_current_cueA
Store the current programmer state as a cue (DESTRUCTIVE).

Saves whatever is currently in the programmer (selected fixtures +
active values) into a cue in the specified sequence. This is how
lighting looks are programmed into a show.

Executor-sequence relationship:
  When sequence_id is omitted, MA2 stores into the sequence assigned to
  the currently selected executor on the console. Use select_executor()
  first to set the target, or pass sequence_id explicitly to make the
  destination unambiguous regardless of executor selection state.

  select executor N      → sets executor N as the active store target
  Store Cue M            → stores into the sequence on selected executor
  Store Cue M Sequence S → stores into sequence S directly (preferred)

Args:
    cue_number: Cue number to store (required)
    sequence_id: Sequence to store into. Omit to use the selected executor's
                 sequence (call select_executor() first if needed)
    label: Optional name for the cue
    merge: Merge new values into existing cue (default False)
    overwrite: Replace existing cue completely (default False)
    confirm_destructive: Must be True to execute (DESTRUCTIVE operation)

Returns:
    str: JSON with commands_sent and raw_response.

Examples:
    - Store cue 5 (explicit sequence): cue_number=5, sequence_id=1, confirm_destructive=True
    - Store cue 3 named "Opening Look": cue_number=3, label="Opening Look", confirm_destructive=True
    - Merge into cue 1: cue_number=1, merge=True, confirm_destructive=True

Inputs: cue_number (required), label, merge, overwrite, +2 more. Returns: result

store_matricks_presetA
Set MAtricks state, store to pool, and label — all in one call (DESTRUCTIVE).

Workflow:
  1. Optionally resets all MAtricks settings (reset_first=True, default)
  2. Applies specified MAtricks settings (interleave, blocks, groups, wings, filter)
  3. Stores current MAtricks state to the specified pool slot (/overwrite)
  4. Labels the pool object with the given name

At least one MAtricks setting must be provided.

Args:
    pool_slot: Pool slot number to store into (e.g. 2).
    name: Label for the stored MAtricks object (e.g. "Wings-2-I4").
    interleave: Virtual grid width (MAtricksInterleave).
    blocks: Block size X (MAtricksBlocks). Use with blocks_y for x.y.
    blocks_y: Block size Y (requires blocks for x.y notation).
    groups: Align group size X (MAtricksGroups). Use with groups_y for x.y.
    groups_y: Align group size Y (requires groups for x.y notation).
    wings: Wing/mirror parts (MAtricksWings).
    filter_num: Filter number (MAtricksFilter).
    filter_name: Filter name (MAtricksFilter, e.g. "OddID").
    reset_first: Reset all MAtricks before applying (default True).
    confirm_destructive: Must be True to execute (DESTRUCTIVE operation).

Returns:
    str: JSON with commands_sent list, pool_slot, name, risk_tier.

Inputs: name (required), pool_slot (required), wings, blocks, +8 more. Returns: result

store_new_presetA
Store the current programmer values as a preset.

Saves the active fixture values (from the programmer) into a preset
slot for later recall with apply_preset.

Preset types: "dimmer" (1), "position" (2), "gobo" (3), "color" (4),
"beam" (5), "focus" (6), "control" (7), "shapers" (8), "video" (9)

Scope flags (mutually exclusive — pick at most one):
  universal   — stores values indexed by fixture type (applies to any fixture
                of the same profile; not tied to specific fixture IDs).
  selective   — stores values tied to the specific fixtures selected during
                store. Recalled preset only affects those fixture IDs.
  global_scope — stores absolute values (no relative/tracking offset).

Workflow for universal color presets:
  1. SelFix 1 Thru 999
  2. attribute "ColorRgb1" at 100
  3. store_new_preset("color", 6, universal=True, overwrite=True, confirm_destructive=True)

SAFETY: This is a STORE operation which modifies show data.

Args:
    preset_type: Preset type name (e.g. "color", "position", "gobo")
    preset_id: Preset number within that type
    merge: Merge into existing preset (default False)
    overwrite: Replace existing preset with /overwrite flag (default False)
    universal: Store as universal preset — applies to any fixture of the same type
    selective: Store as selective preset — applies only to selected fixture IDs
    global_scope: Store with global (absolute) values
    confirm_destructive: Must be True to execute (DESTRUCTIVE operation)

Returns:
    str: JSON with command_sent and raw_response.

Examples:
    - Store universal color preset: preset_type="color", preset_id=6, universal=True, confirm_destructive=True
    - Overwrite position preset 3: preset_type="position", preset_id=3, overwrite=True, confirm_destructive=True

Inputs: preset_id (required), preset_type (required), merge, overwrite, +4 more. Returns: result

store_objectA
Store (create) a generic object in the show — macros, effects, worlds, etc.

For cues, use store_current_cue. For presets, use store_new_preset.
For groups, use create_fixture_group. This tool handles everything else.

SAFETY: This is a DESTRUCTIVE operation. Requires confirm_destructive=True.

Args:
    object_type: Object type to store (e.g. "macro", "effect", "world",
        "sequence", "executor", "timecode")
    object_id: Object ID number or slot
    name: Optional name for the stored object
    merge: Merge into existing object if present
    overwrite: Overwrite existing object if present
    noconfirm: Skip console confirmation dialog
    confirm_destructive: Must be True to execute (safety gate)

Returns:
    str: JSON with command_sent, raw_response, or block info.

Examples:
    - Store macro 5: object_type="macro", object_id=5
    - Store effect 1 named "Rainbow": object_type="effect", object_id=1, name="Rainbow"
    - Overwrite sequence 3: object_type="sequence", object_id=3, overwrite=True

Inputs: object_id (required), object_type (required), name, merge, +3 more. Returns: result

store_timecode_eventB
Store a timecode trigger event that fires a cue at a specific time (DESTRUCTIVE).

Args:
    timecode_id: Timecode show ID (1-256)
    cue_id: Cue to trigger
    sequence_id: Sequence containing the cue
    confirm_destructive: Must be True to execute
    timecode_position: HH:MM:SS:FF position string (optional)

Returns:
    str: JSON result with command sent

Inputs: cue_id (required), sequence_id (required), timecode_id (required), timecode_position, +1 more. Returns: result

store_worldA
Create (store) a new World pool object on the grandMA2 console. (DESTRUCTIVE)

Worlds restrict which fixtures a user profile can control. After storing,
use assign_world_to_user_profile to attach the world to a user.

Args:
    world_id: World slot number (1-256)
    name: Optional label applied immediately after store
    overwrite: If True, adds /overwrite flag (replaces existing slot)
    confirm_destructive: Must be True to execute

Returns:
    str: JSON with commands_sent and raw_responses.

Inputs: world_id (required), name, overwrite, confirm_destructive. Returns: result

suggest_skills_for_taskA

Suggest skills from .claude/skills/ for a natural-language intent (SAFE_READ).

Args:
    intent: What you want to do, e.g. "make me a color picker".
    top_k: Max number of suggestions to return.
    include_destructive: When False, drop un-approved DESTRUCTIVE skills.
    prefer_semantic: When True, attempt embedding-based ranking when a
        ``GITHUB_MODELS_TOKEN`` env var is set. Path A ships keyword only;
        this flag controls the warning message rather than the algorithm.

Returns:
    JSON-encoded SuggestSkillsResponse: ``{intent, method, warning, suggestions}``.

Inputs: intent (required), top_k, prefer_semantic, include_destructive. Returns: result

suggest_tool_for_taskA
Suggest MCP tools for a natural-language task description (SAFE_READ).

Embeds the task description and finds the closest tools by cosine
similarity against stored docstring embeddings.  Falls back to keyword
matching when using the zero-vector provider or when no embedding token
is available.

Args:
    task_description: What you want to accomplish (e.g. "fade out all fixtures").
    top_n: Number of suggestions to return (default 3).
    provider: Embedding provider — "zero" (keyword fallback) or "github".
        Overridden by ``prefer_semantic`` when a token is available.
    prefer_semantic: When True (default), automatically use embedding-based
        search if GITHUB_MODELS_TOKEN is set in the environment.  Falls back
        to keyword matching with a ``warning`` field when no token is present.
        Set to False to force keyword matching regardless of token availability.

Returns:
    str: JSON array of suggested tools with scores and descriptions.
         Includes a top-level ``warning`` key when semantic search was
         requested but fell back to keyword matching.

Inputs: task_description (required), top_n, provider, prefer_semantic. Returns: result

system_adminA
System administration — login, logout, lock, unlock, lua, chat,
reboot, restart, shutdown.

Args:
    action: One of:
        SAFE_READ: "logout"
        SAFE_WRITE: "login", "lock", "unlock", "chat"
        DESTRUCTIVE: "lua", "reboot", "restart", "shutdown"
    user: Username (required for login)
    password: Password (required for login; optional for lock/unlock)
    script: Lua script string (required for lua)
    message: Chat message text (required for chat)
    confirm_destructive: Must be True for lua/reboot/restart/shutdown

Returns:
    str: JSON with command_sent, raw_response, risk_tier

Inputs: action (required), user, script, message, +2 more. Returns: result

toggle_console_modeA
Toggle a console mode on/off (blind, highlight, solo, freeze).

These are toggle commands — each call flips the current state.

Args:
    mode: "blind", "highlight", "solo", or "freeze"

Returns:
    str: JSON result with command sent

Inputs: mode (required). Returns: result

trace_attribute_lineageA
Trace likely sources of an attribute's current value (SAFE_READ).

This is a best-effort lineage tool for debugging "why is this here?"
scenarios. It combines live snapshot context with cue text scans to find
candidate sequence/cue sources mentioning the attribute and, optionally,
the target fixture.

Args:
    attribute: Attribute name to search for (e.g. "Dimmer", "ColorRGB1").
    fixture_id: Optional fixture ID to narrow the lineage search.
    sequence_id: Optional sequence to inspect directly.
    max_sequences: Max sequences to inspect when sequence_id is omitted.
    max_cues_per_sequence: Max cues per sequence to inspect.

Returns:
    str: JSON with live_context, candidate_sources, inspected_sequences, summary.

Inputs: attribute (required), fixture_id, sequence_id, max_sequences, +1 more. Returns: result

undo_last_actionA
Undo the last N actions on the console (sends 'oops' N times).

Args:
    count: Number of actions to undo (1-20, default 1)

Returns:
    str: JSON result with all raw responses

Inputs: count. Returns: result

unlock_console_uiB
Unlock the grandMA2 console UI.

Args:
    password: Optional unlock password if the console was locked with one.

Returns:
    str: JSON with command_sent and raw_response.

Inputs: password. Returns: result

unpark_fixtureA
Unpark a previously parked fixture or DMX address.

Fixture targets are pre-validated before unparking. DMX targets bypass
pre-validation.

Args:
    target: What to unpark (e.g. "fixture 20", "dmx 101", "fixture 20 thru 30")

Returns:
    str: JSON with command_sent (None if blocked), raw_response, exists.

Examples:
    - Unpark fixture 20: target="fixture 20"
    - Unpark DMX 101: target="dmx 101"

Inputs: target (required). Returns: result

unpatch_fixtureA
Unpatch a fixture (remove its DMX assignment) (DESTRUCTIVE).

MA2 syntax: delete fixture [fixture_id]
This removes the DMX assignment but does not delete the fixture from the show.

Args:
    fixture_id: Fixture ID to unpatch.
    confirm_destructive: Must be True to proceed.

Returns:
    str: JSON with command_sent, raw_response, risk_tier.

Inputs: fixture_id (required), confirm_destructive. Returns: result

update_cue_dataA
Update a cue with current programmer values (DESTRUCTIVE).

Args:
    confirm_destructive: Must be True to execute
    cue_id: Cue number to update (optional; updates active cue if omitted)
    sequence_id: Sequence ID for scoping (optional)
    merge: Merge programmer into existing cue values
    overwrite: Overwrite cue with programmer values
    cueonly: Prevent tracking forward (True) or allow (False)

Returns:
    str: JSON result with command sent

Inputs: merge, cue_id, cueonly, overwrite, +2 more. Returns: result

update_objectA
Update any object with current programmer values (DESTRUCTIVE).

Generic update tool that works with all 16 object types.
For cue-specific updates with sequence scoping, prefer update_cue_data.

Args:
    object_type: Object type — cue, group, preset, sequence, effect, macro, etc.
    object_id: Object ID (optional; updates active if omitted for cue)
    sequence_id: Sequence ID for cue-scoped updates (only used when object_type="cue")
    merge: Merge programmer into existing values
    overwrite: Overwrite existing values with programmer
    cueonly: Prevent changes from tracking forward (True) or allow (False)
    confirm_destructive: Must be True to execute

Returns:
    str: JSON with command_sent, raw_response, risk_tier

Inputs: object_type (required), merge, cueonly, object_id, +3 more. Returns: result

validate_preset_referencesA
Scan a sequence's cues for references to presets that no longer exist in the pool.

Samples up to `sample_cues` cues from the sequence, inspects each for preset
references, and cross-checks against the current preset pool. Returns a list
of broken references that would cause silent failures during playback.

Safe to run before any performance. Read-only — no console side effects.

Args:
    sequence_id: The sequence to validate.
    sample_cues: Number of cues to sample (default 5). Use 0 for all cues.

Returns JSON with:
- sequence_id: int
- cues_checked: int
- broken_references: list of {cue_id, preset_type, preset_id, detail}
- valid_references: int count
- status: "PASS" or "FAIL"

Inputs: sequence_id (required), sample_cues. Returns: result

validate_universal_preset_coverageB
Check whether a universal preset slot range is populated cleanly (SAFE_READ).

Args:
    preset_type: Preset type name (e.g. "color", "position").
    start_id: First preset slot in the expected range.
    end_id: Last preset slot in the expected range.

Returns:
    str: JSON with occupied slots, missing slots, coverage percent, and recommendation.

Inputs: end_id (required), start_id (required), preset_type (required). Returns: result

verify_fixture_id_blocksA
Verify fixture IDs against the 100-block numbering scheme (SAFE_READ).

Scheme: 1-99 wash, 100-199 movers, 200-299 bars, 300-399 strobes,
400-499 blinders. Reports per-category compliance, out-of-block fixtures,
ID collisions, and a proposed renumbering plan (old_id -> new_id into the
lowest free slot of the correct block).

Preset/color-picker plugins depend on clean type blocks — run this before
run_preset_plugin or plugin-driven preset creation.

Args:
    discover_attributes: Passed through to the patch-model build.

Returns:
    str: JSON report with categories, out_of_block, collisions,
    renumber_plan, proposed_commands, compliant, risk_tier.

Inputs: discover_attributes. Returns: result

watch_system_varA
    Poll a grandMA2 system variable until it matches an expected value or times out.

    Uses ListVar telnet command. Requires an active telnet connection.

    Args:
        var_name:        Variable name (with or without leading $, case-insensitive).
                         e.g. "FADERPAGE" or "$FADERPAGE"
        expected_value:  Value to wait for (string comparison).
        timeout_seconds: Maximum wait time in seconds (capped at 30.0).
        poll_interval:   Seconds between polls (minimum 0.1).

    Returns:
        str: JSON with matched, final_value, elapsed_seconds, polls.
    

Inputs: var_name (required), expected_value (required), poll_interval, timeout_seconds. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 237 tools

    Disambiguation1/5

    The 237-tool surface contains many overlapping clusters: multiple console-state/snapshot readers, several executor status/detail/state tools, many list/browse/query tools for pools, and multiple assign/select/store variants. An agent cannot reliably distinguish, for example, get_console_state vs get_showfile_info vs incident_snapshot, or query_object_list vs list_pool_names vs list_console_destination.

    Naming Consistency3/5

    All names use snake_case, so casing is consistent. However conventions are mixed: some are verb_noun (get_console_state), some noun-first (playback_action, system_admin, plugin_management), some action_or_noun (label_or_appearance), and read operations use list/get/browse/query/scan/inspect interchangeably. It remains readable but not a single predictable pattern.

    Tool Count1/5

    237 tools is far beyond a well-scoped set; the rubric treats 50+ as an extreme mismatch. The server bundles core console control, agent orchestration, skill registry, telemetry, RAG search, clustering, and compliance reporting into one surface.

    Completeness2/5

    Despite huge breadth, there are significant core gaps: no create_fixture_group, no store_new_preset, no list_fixtures, no disconnect_console, no navigate_console, and no execute_sequence, even though several tools explicitly reference them. Cue storage exists via store_cue_with_timing, but group/preset creation and basic fixture listing are dead ends that will cause agent failures.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      C
      maintenance
      An MCP server that lets AI assistants control grandMA2 lighting consoles via Telnet, exposing 41 high-level tools for cue management, fixture control, preset management, executor control, macro editing, appearance assignment, bulk operations, console state queries, show file management, read-back verification, and music show workflows.
      100
      20
      Apache 2.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Transforms an ETC Eos lighting console into a service controllable by AI assistants and automation tools via MCP and OSC, enabling cue management, preset recall, and channel level control.
      4
      AGPL 3.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables users to control grandMA3 consoles through official OSC /cmd commands, with an admin UI for IP scanning, object/action permissions, chat integration, and MCP stdio access.
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables MCP clients such as Claude Code or Claude Desktop to control grandMA3 onPC by executing command-line commands, running Lua, reading show data like sequences, cues, executors, patch and pools, driving playback and faders, and looking things up in the manual. It works through a Lua bridge plugin inside onPC, falling back to OSC for write-only commands when the bridge is unavailable.
      75
      9
      MIT